binutils-gdb/gdb/arm-tdep.c

13394 lines
390 KiB
C
Raw Normal View History

1999-12-22 22:45:38 +01:00
/* Common target dependent code for GDB on ARM systems.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
1999-07-07 22:19:36 +02:00
This file is part of GDB.
1999-07-07 22:19:36 +02:00
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
1999-07-07 22:19:36 +02:00
(at your option) any later version.
1999-07-07 22:19:36 +02:00
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
1999-07-07 22:19:36 +02:00
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include <ctype.h> /* XXX for isupper (). */
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "frame.h"
#include "inferior.h"
#include "infrun.h"
#include "gdbcmd.h"
#include "gdbcore.h"
#include "dis-asm.h" /* For register styles. */
#include "disasm.h"
#include "regcache.h"
#include "reggroups.h"
#include "target-float.h"
#include "value.h"
Sort includes for files gdb/[a-f]*.[chyl]. This patch sorts the include files for the files [a-f]*.[chyl]. The patch was written by a script. Tested by the buildbot. I will follow up with patches to sort the remaining files, by sorting a subset, testing them, and then checking them in. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> * ft32-tdep.c: Sort headers. * frv-tdep.c: Sort headers. * frv-linux-tdep.c: Sort headers. * frame.c: Sort headers. * frame-unwind.c: Sort headers. * frame-base.c: Sort headers. * fork-child.c: Sort headers. * findvar.c: Sort headers. * findcmd.c: Sort headers. * filesystem.c: Sort headers. * filename-seen-cache.h: Sort headers. * filename-seen-cache.c: Sort headers. * fbsd-tdep.c: Sort headers. * fbsd-nat.h: Sort headers. * fbsd-nat.c: Sort headers. * f-valprint.c: Sort headers. * f-typeprint.c: Sort headers. * f-lang.c: Sort headers. * extension.h: Sort headers. * extension.c: Sort headers. * extension-priv.h: Sort headers. * expprint.c: Sort headers. * exec.h: Sort headers. * exec.c: Sort headers. * exceptions.c: Sort headers. * event-top.c: Sort headers. * event-loop.c: Sort headers. * eval.c: Sort headers. * elfread.c: Sort headers. * dwarf2read.h: Sort headers. * dwarf2read.c: Sort headers. * dwarf2loc.c: Sort headers. * dwarf2expr.h: Sort headers. * dwarf2expr.c: Sort headers. * dwarf2-frame.c: Sort headers. * dwarf2-frame-tailcall.c: Sort headers. * dwarf-index-write.h: Sort headers. * dwarf-index-write.c: Sort headers. * dwarf-index-common.c: Sort headers. * dwarf-index-cache.h: Sort headers. * dwarf-index-cache.c: Sort headers. * dummy-frame.c: Sort headers. * dtrace-probe.c: Sort headers. * disasm.h: Sort headers. * disasm.c: Sort headers. * disasm-selftests.c: Sort headers. * dictionary.c: Sort headers. * dicos-tdep.c: Sort headers. * demangle.c: Sort headers. * dcache.h: Sort headers. * dcache.c: Sort headers. * darwin-nat.h: Sort headers. * darwin-nat.c: Sort headers. * darwin-nat-info.c: Sort headers. * d-valprint.c: Sort headers. * d-namespace.c: Sort headers. * d-lang.c: Sort headers. * ctf.c: Sort headers. * csky-tdep.c: Sort headers. * csky-linux-tdep.c: Sort headers. * cris-tdep.c: Sort headers. * cris-linux-tdep.c: Sort headers. * cp-valprint.c: Sort headers. * cp-support.c: Sort headers. * cp-namespace.c: Sort headers. * cp-abi.c: Sort headers. * corelow.c: Sort headers. * corefile.c: Sort headers. * continuations.c: Sort headers. * completer.h: Sort headers. * completer.c: Sort headers. * complaints.c: Sort headers. * coffread.c: Sort headers. * coff-pe-read.c: Sort headers. * cli-out.h: Sort headers. * cli-out.c: Sort headers. * charset.c: Sort headers. * c-varobj.c: Sort headers. * c-valprint.c: Sort headers. * c-typeprint.c: Sort headers. * c-lang.c: Sort headers. * buildsym.c: Sort headers. * buildsym-legacy.c: Sort headers. * build-id.h: Sort headers. * build-id.c: Sort headers. * btrace.c: Sort headers. * bsd-uthread.c: Sort headers. * breakpoint.h: Sort headers. * breakpoint.c: Sort headers. * break-catch-throw.c: Sort headers. * break-catch-syscall.c: Sort headers. * break-catch-sig.c: Sort headers. * blockframe.c: Sort headers. * block.c: Sort headers. * bfin-tdep.c: Sort headers. * bfin-linux-tdep.c: Sort headers. * bfd-target.c: Sort headers. * bcache.c: Sort headers. * ax-general.c: Sort headers. * ax-gdb.h: Sort headers. * ax-gdb.c: Sort headers. * avr-tdep.c: Sort headers. * auxv.c: Sort headers. * auto-load.c: Sort headers. * arm-wince-tdep.c: Sort headers. * arm-tdep.c: Sort headers. * arm-symbian-tdep.c: Sort headers. * arm-pikeos-tdep.c: Sort headers. * arm-obsd-tdep.c: Sort headers. * arm-nbsd-tdep.c: Sort headers. * arm-nbsd-nat.c: Sort headers. * arm-linux-tdep.c: Sort headers. * arm-linux-nat.c: Sort headers. * arm-fbsd-tdep.c: Sort headers. * arm-fbsd-nat.c: Sort headers. * arm-bsd-tdep.c: Sort headers. * arch-utils.c: Sort headers. * arc-tdep.c: Sort headers. * arc-newlib-tdep.c: Sort headers. * annotate.h: Sort headers. * annotate.c: Sort headers. * amd64-windows-tdep.c: Sort headers. * amd64-windows-nat.c: Sort headers. * amd64-tdep.c: Sort headers. * amd64-sol2-tdep.c: Sort headers. * amd64-obsd-tdep.c: Sort headers. * amd64-obsd-nat.c: Sort headers. * amd64-nbsd-tdep.c: Sort headers. * amd64-nbsd-nat.c: Sort headers. * amd64-nat.c: Sort headers. * amd64-linux-tdep.c: Sort headers. * amd64-linux-nat.c: Sort headers. * amd64-fbsd-tdep.c: Sort headers. * amd64-fbsd-nat.c: Sort headers. * amd64-dicos-tdep.c: Sort headers. * amd64-darwin-tdep.c: Sort headers. * amd64-bsd-nat.c: Sort headers. * alpha-tdep.c: Sort headers. * alpha-obsd-tdep.c: Sort headers. * alpha-nbsd-tdep.c: Sort headers. * alpha-mdebug-tdep.c: Sort headers. * alpha-linux-tdep.c: Sort headers. * alpha-linux-nat.c: Sort headers. * alpha-bsd-tdep.c: Sort headers. * alpha-bsd-nat.c: Sort headers. * aix-thread.c: Sort headers. * agent.c: Sort headers. * addrmap.c: Sort headers. * ada-varobj.c: Sort headers. * ada-valprint.c: Sort headers. * ada-typeprint.c: Sort headers. * ada-tasks.c: Sort headers. * ada-lang.c: Sort headers. * aarch64-tdep.c: Sort headers. * aarch64-ravenscar-thread.c: Sort headers. * aarch64-newlib-tdep.c: Sort headers. * aarch64-linux-tdep.c: Sort headers. * aarch64-linux-nat.c: Sort headers. * aarch64-fbsd-tdep.c: Sort headers. * aarch64-fbsd-nat.c: Sort headers. * aarch32-linux-nat.c: Sort headers.
2019-04-03 04:04:24 +02:00
#include "arch-utils.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "osabi.h"
#include "frame-unwind.h"
#include "frame-base.h"
#include "trad-frame.h"
#include "objfiles.h"
Move DWARF code to dwarf2/ subdirectory This moves all the remaining DWARF code to the new dwarf2 subdirectory. This is just a simple renaming, with updates to includes as needed. gdb/ChangeLog 2020-02-08 Tom Tromey <tom@tromey.com> * dwarf2/expr.c: Rename from dwarf2expr.c. * dwarf2/expr.h: Rename from dwarf2expr.h. * dwarf2/frame-tailcall.c: Rename from dwarf2-frame-tailcall.c. * dwarf2/frame-tailcall.h: Rename from dwarf2-frame-tailcall.h. * dwarf2/frame.c: Rename from dwarf2-frame.c. * dwarf2/frame.h: Rename from dwarf2-frame.h. * dwarf2/index-cache.c: Rename from dwarf-index-cache.c. * dwarf2/index-cache.h: Rename from dwarf-index-cache.h. * dwarf2/index-common.c: Rename from dwarf-index-common.c. * dwarf2/index-common.h: Rename from dwarf-index-common.h. * dwarf2/index-write.c: Rename from dwarf-index-write.c. * dwarf2/index-write.h: Rename from dwarf-index-write.h. * dwarf2/loc.c: Rename from dwarf2loc.c. * dwarf2/loc.h: Rename from dwarf2loc.h. * dwarf2/read.c: Rename from dwarf2read.c. * dwarf2/read.h: Rename from dwarf2read.h. * dwarf2/abbrev.c, aarch64-tdep.c, alpha-tdep.c, amd64-darwin-tdep.c, arc-tdep.c, arm-tdep.c, bfin-tdep.c, compile/compile-c-symbols.c, compile/compile-cplus-symbols.c, compile/compile-loc2c.c, cris-tdep.c, csky-tdep.c, findvar.c, gdbtypes.c, guile/scm-type.c, h8300-tdep.c, hppa-bsd-tdep.c, hppa-linux-tdep.c, i386-darwin-tdep.c, i386-linux-tdep.c, i386-tdep.c, iq2000-tdep.c, m32c-tdep.c, m68hc11-tdep.c, m68k-tdep.c, microblaze-tdep.c, mips-tdep.c, mn10300-tdep.c, msp430-tdep.c, nds32-tdep.c, nios2-tdep.c, or1k-tdep.c, riscv-tdep.c, rl78-tdep.c, rs6000-tdep.c, rx-tdep.c, s12z-tdep.c, s390-tdep.c, score-tdep.c, sh-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparc64-linux-tdep.c, sparc64-tdep.c, tic6x-tdep.c, tilegx-tdep.c, v850-tdep.c, xstormy16-tdep.c, xtensa-tdep.c: Update. * Makefile.in (COMMON_SFILES): Update. (HFILES_NO_SRCDIR): Update. Change-Id: Ied9ce1436cd27ac4a4cffef10ec92e396f181928
2020-02-08 21:40:54 +01:00
#include "dwarf2/frame.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "gdbtypes.h"
#include "prologue-value.h"
#include "remote.h"
#include "target-descriptions.h"
#include "user-regs.h"
#include "observable.h"
gnulib: import count-one-bits module and use it For a fix I intend to submit, I would need a function that counts the number of set bits in a word. There is __builtin_popcount that is supported by gcc and clang, but there is also a gnulib module that wraps that and provides a fallback for other compilers, so I think it would be good to use it. I also noticed that there is a bitcount function in arch/arm.c, so I thought that as a first step I would replace that one with the gnulib count-one-bits module. This is what this patch does. The gnulib module provides multiple functions, with various parameter length (unsigned int, unsigned long int, unsigned long long int), I chose the one that made sense for each call site based on the argument type. gnulib/ChangeLog: * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import count-one-bits module. * configure: Re-generate. * aclocal.m4: Re-generate. * Makefile.in: Re-generate. * import/count-one-bits.c: New file. * import/count-one-bits.h: New file. * import/Makefile.am: Re-generate. * import/Makefile.in: Re-generate. * import/m4/gnulib-cache.m4: Re-generate. * import/m4/gnulib-comp.m4: Re-generate. * import/m4/count-one-bits.m4: New file. gdb/ChangeLog: * arm-tdep.c: Include count-one-bits.h. (cleanup_block_store_pc): Use count_one_bits. (cleanup_block_load_pc): Use count_one_bits. (arm_copy_block_xfer): Use count_one_bits. (thumb2_copy_block_xfer): Use count_one_bits. (thumb_copy_pop_pc_16bit): Use count_one_bits. * arch/arm-get-next-pcs.c: Include count-one-bits.h. (thumb_get_next_pcs_raw): Use count_one_bits. (arm_get_next_pcs_raw): Use count_one_bits_l. * arch/arm.c (bitcount): Remove. * arch/arm.h (bitcount): Remove.
2020-02-14 20:41:07 +01:00
#include "count-one-bits.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
Sort includes for files gdb/[a-f]*.[chyl]. This patch sorts the include files for the files [a-f]*.[chyl]. The patch was written by a script. Tested by the buildbot. I will follow up with patches to sort the remaining files, by sorting a subset, testing them, and then checking them in. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> * ft32-tdep.c: Sort headers. * frv-tdep.c: Sort headers. * frv-linux-tdep.c: Sort headers. * frame.c: Sort headers. * frame-unwind.c: Sort headers. * frame-base.c: Sort headers. * fork-child.c: Sort headers. * findvar.c: Sort headers. * findcmd.c: Sort headers. * filesystem.c: Sort headers. * filename-seen-cache.h: Sort headers. * filename-seen-cache.c: Sort headers. * fbsd-tdep.c: Sort headers. * fbsd-nat.h: Sort headers. * fbsd-nat.c: Sort headers. * f-valprint.c: Sort headers. * f-typeprint.c: Sort headers. * f-lang.c: Sort headers. * extension.h: Sort headers. * extension.c: Sort headers. * extension-priv.h: Sort headers. * expprint.c: Sort headers. * exec.h: Sort headers. * exec.c: Sort headers. * exceptions.c: Sort headers. * event-top.c: Sort headers. * event-loop.c: Sort headers. * eval.c: Sort headers. * elfread.c: Sort headers. * dwarf2read.h: Sort headers. * dwarf2read.c: Sort headers. * dwarf2loc.c: Sort headers. * dwarf2expr.h: Sort headers. * dwarf2expr.c: Sort headers. * dwarf2-frame.c: Sort headers. * dwarf2-frame-tailcall.c: Sort headers. * dwarf-index-write.h: Sort headers. * dwarf-index-write.c: Sort headers. * dwarf-index-common.c: Sort headers. * dwarf-index-cache.h: Sort headers. * dwarf-index-cache.c: Sort headers. * dummy-frame.c: Sort headers. * dtrace-probe.c: Sort headers. * disasm.h: Sort headers. * disasm.c: Sort headers. * disasm-selftests.c: Sort headers. * dictionary.c: Sort headers. * dicos-tdep.c: Sort headers. * demangle.c: Sort headers. * dcache.h: Sort headers. * dcache.c: Sort headers. * darwin-nat.h: Sort headers. * darwin-nat.c: Sort headers. * darwin-nat-info.c: Sort headers. * d-valprint.c: Sort headers. * d-namespace.c: Sort headers. * d-lang.c: Sort headers. * ctf.c: Sort headers. * csky-tdep.c: Sort headers. * csky-linux-tdep.c: Sort headers. * cris-tdep.c: Sort headers. * cris-linux-tdep.c: Sort headers. * cp-valprint.c: Sort headers. * cp-support.c: Sort headers. * cp-namespace.c: Sort headers. * cp-abi.c: Sort headers. * corelow.c: Sort headers. * corefile.c: Sort headers. * continuations.c: Sort headers. * completer.h: Sort headers. * completer.c: Sort headers. * complaints.c: Sort headers. * coffread.c: Sort headers. * coff-pe-read.c: Sort headers. * cli-out.h: Sort headers. * cli-out.c: Sort headers. * charset.c: Sort headers. * c-varobj.c: Sort headers. * c-valprint.c: Sort headers. * c-typeprint.c: Sort headers. * c-lang.c: Sort headers. * buildsym.c: Sort headers. * buildsym-legacy.c: Sort headers. * build-id.h: Sort headers. * build-id.c: Sort headers. * btrace.c: Sort headers. * bsd-uthread.c: Sort headers. * breakpoint.h: Sort headers. * breakpoint.c: Sort headers. * break-catch-throw.c: Sort headers. * break-catch-syscall.c: Sort headers. * break-catch-sig.c: Sort headers. * blockframe.c: Sort headers. * block.c: Sort headers. * bfin-tdep.c: Sort headers. * bfin-linux-tdep.c: Sort headers. * bfd-target.c: Sort headers. * bcache.c: Sort headers. * ax-general.c: Sort headers. * ax-gdb.h: Sort headers. * ax-gdb.c: Sort headers. * avr-tdep.c: Sort headers. * auxv.c: Sort headers. * auto-load.c: Sort headers. * arm-wince-tdep.c: Sort headers. * arm-tdep.c: Sort headers. * arm-symbian-tdep.c: Sort headers. * arm-pikeos-tdep.c: Sort headers. * arm-obsd-tdep.c: Sort headers. * arm-nbsd-tdep.c: Sort headers. * arm-nbsd-nat.c: Sort headers. * arm-linux-tdep.c: Sort headers. * arm-linux-nat.c: Sort headers. * arm-fbsd-tdep.c: Sort headers. * arm-fbsd-nat.c: Sort headers. * arm-bsd-tdep.c: Sort headers. * arch-utils.c: Sort headers. * arc-tdep.c: Sort headers. * arc-newlib-tdep.c: Sort headers. * annotate.h: Sort headers. * annotate.c: Sort headers. * amd64-windows-tdep.c: Sort headers. * amd64-windows-nat.c: Sort headers. * amd64-tdep.c: Sort headers. * amd64-sol2-tdep.c: Sort headers. * amd64-obsd-tdep.c: Sort headers. * amd64-obsd-nat.c: Sort headers. * amd64-nbsd-tdep.c: Sort headers. * amd64-nbsd-nat.c: Sort headers. * amd64-nat.c: Sort headers. * amd64-linux-tdep.c: Sort headers. * amd64-linux-nat.c: Sort headers. * amd64-fbsd-tdep.c: Sort headers. * amd64-fbsd-nat.c: Sort headers. * amd64-dicos-tdep.c: Sort headers. * amd64-darwin-tdep.c: Sort headers. * amd64-bsd-nat.c: Sort headers. * alpha-tdep.c: Sort headers. * alpha-obsd-tdep.c: Sort headers. * alpha-nbsd-tdep.c: Sort headers. * alpha-mdebug-tdep.c: Sort headers. * alpha-linux-tdep.c: Sort headers. * alpha-linux-nat.c: Sort headers. * alpha-bsd-tdep.c: Sort headers. * alpha-bsd-nat.c: Sort headers. * aix-thread.c: Sort headers. * agent.c: Sort headers. * addrmap.c: Sort headers. * ada-varobj.c: Sort headers. * ada-valprint.c: Sort headers. * ada-typeprint.c: Sort headers. * ada-tasks.c: Sort headers. * ada-lang.c: Sort headers. * aarch64-tdep.c: Sort headers. * aarch64-ravenscar-thread.c: Sort headers. * aarch64-newlib-tdep.c: Sort headers. * aarch64-linux-tdep.c: Sort headers. * aarch64-linux-nat.c: Sort headers. * aarch64-fbsd-tdep.c: Sort headers. * aarch64-fbsd-nat.c: Sort headers. * aarch32-linux-nat.c: Sort headers.
2019-04-03 04:04:24 +02:00
#include "arch/arm.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "arch/arm-get-next-pcs.h"
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
#include "arm-tdep.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "gdb/sim-arm.h"
Sort includes for files gdb/[a-f]*.[chyl]. This patch sorts the include files for the files [a-f]*.[chyl]. The patch was written by a script. Tested by the buildbot. I will follow up with patches to sort the remaining files, by sorting a subset, testing them, and then checking them in. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> * ft32-tdep.c: Sort headers. * frv-tdep.c: Sort headers. * frv-linux-tdep.c: Sort headers. * frame.c: Sort headers. * frame-unwind.c: Sort headers. * frame-base.c: Sort headers. * fork-child.c: Sort headers. * findvar.c: Sort headers. * findcmd.c: Sort headers. * filesystem.c: Sort headers. * filename-seen-cache.h: Sort headers. * filename-seen-cache.c: Sort headers. * fbsd-tdep.c: Sort headers. * fbsd-nat.h: Sort headers. * fbsd-nat.c: Sort headers. * f-valprint.c: Sort headers. * f-typeprint.c: Sort headers. * f-lang.c: Sort headers. * extension.h: Sort headers. * extension.c: Sort headers. * extension-priv.h: Sort headers. * expprint.c: Sort headers. * exec.h: Sort headers. * exec.c: Sort headers. * exceptions.c: Sort headers. * event-top.c: Sort headers. * event-loop.c: Sort headers. * eval.c: Sort headers. * elfread.c: Sort headers. * dwarf2read.h: Sort headers. * dwarf2read.c: Sort headers. * dwarf2loc.c: Sort headers. * dwarf2expr.h: Sort headers. * dwarf2expr.c: Sort headers. * dwarf2-frame.c: Sort headers. * dwarf2-frame-tailcall.c: Sort headers. * dwarf-index-write.h: Sort headers. * dwarf-index-write.c: Sort headers. * dwarf-index-common.c: Sort headers. * dwarf-index-cache.h: Sort headers. * dwarf-index-cache.c: Sort headers. * dummy-frame.c: Sort headers. * dtrace-probe.c: Sort headers. * disasm.h: Sort headers. * disasm.c: Sort headers. * disasm-selftests.c: Sort headers. * dictionary.c: Sort headers. * dicos-tdep.c: Sort headers. * demangle.c: Sort headers. * dcache.h: Sort headers. * dcache.c: Sort headers. * darwin-nat.h: Sort headers. * darwin-nat.c: Sort headers. * darwin-nat-info.c: Sort headers. * d-valprint.c: Sort headers. * d-namespace.c: Sort headers. * d-lang.c: Sort headers. * ctf.c: Sort headers. * csky-tdep.c: Sort headers. * csky-linux-tdep.c: Sort headers. * cris-tdep.c: Sort headers. * cris-linux-tdep.c: Sort headers. * cp-valprint.c: Sort headers. * cp-support.c: Sort headers. * cp-namespace.c: Sort headers. * cp-abi.c: Sort headers. * corelow.c: Sort headers. * corefile.c: Sort headers. * continuations.c: Sort headers. * completer.h: Sort headers. * completer.c: Sort headers. * complaints.c: Sort headers. * coffread.c: Sort headers. * coff-pe-read.c: Sort headers. * cli-out.h: Sort headers. * cli-out.c: Sort headers. * charset.c: Sort headers. * c-varobj.c: Sort headers. * c-valprint.c: Sort headers. * c-typeprint.c: Sort headers. * c-lang.c: Sort headers. * buildsym.c: Sort headers. * buildsym-legacy.c: Sort headers. * build-id.h: Sort headers. * build-id.c: Sort headers. * btrace.c: Sort headers. * bsd-uthread.c: Sort headers. * breakpoint.h: Sort headers. * breakpoint.c: Sort headers. * break-catch-throw.c: Sort headers. * break-catch-syscall.c: Sort headers. * break-catch-sig.c: Sort headers. * blockframe.c: Sort headers. * block.c: Sort headers. * bfin-tdep.c: Sort headers. * bfin-linux-tdep.c: Sort headers. * bfd-target.c: Sort headers. * bcache.c: Sort headers. * ax-general.c: Sort headers. * ax-gdb.h: Sort headers. * ax-gdb.c: Sort headers. * avr-tdep.c: Sort headers. * auxv.c: Sort headers. * auto-load.c: Sort headers. * arm-wince-tdep.c: Sort headers. * arm-tdep.c: Sort headers. * arm-symbian-tdep.c: Sort headers. * arm-pikeos-tdep.c: Sort headers. * arm-obsd-tdep.c: Sort headers. * arm-nbsd-tdep.c: Sort headers. * arm-nbsd-nat.c: Sort headers. * arm-linux-tdep.c: Sort headers. * arm-linux-nat.c: Sort headers. * arm-fbsd-tdep.c: Sort headers. * arm-fbsd-nat.c: Sort headers. * arm-bsd-tdep.c: Sort headers. * arch-utils.c: Sort headers. * arc-tdep.c: Sort headers. * arc-newlib-tdep.c: Sort headers. * annotate.h: Sort headers. * annotate.c: Sort headers. * amd64-windows-tdep.c: Sort headers. * amd64-windows-nat.c: Sort headers. * amd64-tdep.c: Sort headers. * amd64-sol2-tdep.c: Sort headers. * amd64-obsd-tdep.c: Sort headers. * amd64-obsd-nat.c: Sort headers. * amd64-nbsd-tdep.c: Sort headers. * amd64-nbsd-nat.c: Sort headers. * amd64-nat.c: Sort headers. * amd64-linux-tdep.c: Sort headers. * amd64-linux-nat.c: Sort headers. * amd64-fbsd-tdep.c: Sort headers. * amd64-fbsd-nat.c: Sort headers. * amd64-dicos-tdep.c: Sort headers. * amd64-darwin-tdep.c: Sort headers. * amd64-bsd-nat.c: Sort headers. * alpha-tdep.c: Sort headers. * alpha-obsd-tdep.c: Sort headers. * alpha-nbsd-tdep.c: Sort headers. * alpha-mdebug-tdep.c: Sort headers. * alpha-linux-tdep.c: Sort headers. * alpha-linux-nat.c: Sort headers. * alpha-bsd-tdep.c: Sort headers. * alpha-bsd-nat.c: Sort headers. * aix-thread.c: Sort headers. * agent.c: Sort headers. * addrmap.c: Sort headers. * ada-varobj.c: Sort headers. * ada-valprint.c: Sort headers. * ada-typeprint.c: Sort headers. * ada-tasks.c: Sort headers. * ada-lang.c: Sort headers. * aarch64-tdep.c: Sort headers. * aarch64-ravenscar-thread.c: Sort headers. * aarch64-newlib-tdep.c: Sort headers. * aarch64-linux-tdep.c: Sort headers. * aarch64-linux-nat.c: Sort headers. * aarch64-fbsd-tdep.c: Sort headers. * aarch64-fbsd-nat.c: Sort headers. * aarch32-linux-nat.c: Sort headers.
2019-04-03 04:04:24 +02:00
#include "elf-bfd.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "coff/internal.h"
Sort includes for files gdb/[a-f]*.[chyl]. This patch sorts the include files for the files [a-f]*.[chyl]. The patch was written by a script. Tested by the buildbot. I will follow up with patches to sort the remaining files, by sorting a subset, testing them, and then checking them in. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> * ft32-tdep.c: Sort headers. * frv-tdep.c: Sort headers. * frv-linux-tdep.c: Sort headers. * frame.c: Sort headers. * frame-unwind.c: Sort headers. * frame-base.c: Sort headers. * fork-child.c: Sort headers. * findvar.c: Sort headers. * findcmd.c: Sort headers. * filesystem.c: Sort headers. * filename-seen-cache.h: Sort headers. * filename-seen-cache.c: Sort headers. * fbsd-tdep.c: Sort headers. * fbsd-nat.h: Sort headers. * fbsd-nat.c: Sort headers. * f-valprint.c: Sort headers. * f-typeprint.c: Sort headers. * f-lang.c: Sort headers. * extension.h: Sort headers. * extension.c: Sort headers. * extension-priv.h: Sort headers. * expprint.c: Sort headers. * exec.h: Sort headers. * exec.c: Sort headers. * exceptions.c: Sort headers. * event-top.c: Sort headers. * event-loop.c: Sort headers. * eval.c: Sort headers. * elfread.c: Sort headers. * dwarf2read.h: Sort headers. * dwarf2read.c: Sort headers. * dwarf2loc.c: Sort headers. * dwarf2expr.h: Sort headers. * dwarf2expr.c: Sort headers. * dwarf2-frame.c: Sort headers. * dwarf2-frame-tailcall.c: Sort headers. * dwarf-index-write.h: Sort headers. * dwarf-index-write.c: Sort headers. * dwarf-index-common.c: Sort headers. * dwarf-index-cache.h: Sort headers. * dwarf-index-cache.c: Sort headers. * dummy-frame.c: Sort headers. * dtrace-probe.c: Sort headers. * disasm.h: Sort headers. * disasm.c: Sort headers. * disasm-selftests.c: Sort headers. * dictionary.c: Sort headers. * dicos-tdep.c: Sort headers. * demangle.c: Sort headers. * dcache.h: Sort headers. * dcache.c: Sort headers. * darwin-nat.h: Sort headers. * darwin-nat.c: Sort headers. * darwin-nat-info.c: Sort headers. * d-valprint.c: Sort headers. * d-namespace.c: Sort headers. * d-lang.c: Sort headers. * ctf.c: Sort headers. * csky-tdep.c: Sort headers. * csky-linux-tdep.c: Sort headers. * cris-tdep.c: Sort headers. * cris-linux-tdep.c: Sort headers. * cp-valprint.c: Sort headers. * cp-support.c: Sort headers. * cp-namespace.c: Sort headers. * cp-abi.c: Sort headers. * corelow.c: Sort headers. * corefile.c: Sort headers. * continuations.c: Sort headers. * completer.h: Sort headers. * completer.c: Sort headers. * complaints.c: Sort headers. * coffread.c: Sort headers. * coff-pe-read.c: Sort headers. * cli-out.h: Sort headers. * cli-out.c: Sort headers. * charset.c: Sort headers. * c-varobj.c: Sort headers. * c-valprint.c: Sort headers. * c-typeprint.c: Sort headers. * c-lang.c: Sort headers. * buildsym.c: Sort headers. * buildsym-legacy.c: Sort headers. * build-id.h: Sort headers. * build-id.c: Sort headers. * btrace.c: Sort headers. * bsd-uthread.c: Sort headers. * breakpoint.h: Sort headers. * breakpoint.c: Sort headers. * break-catch-throw.c: Sort headers. * break-catch-syscall.c: Sort headers. * break-catch-sig.c: Sort headers. * blockframe.c: Sort headers. * block.c: Sort headers. * bfin-tdep.c: Sort headers. * bfin-linux-tdep.c: Sort headers. * bfd-target.c: Sort headers. * bcache.c: Sort headers. * ax-general.c: Sort headers. * ax-gdb.h: Sort headers. * ax-gdb.c: Sort headers. * avr-tdep.c: Sort headers. * auxv.c: Sort headers. * auto-load.c: Sort headers. * arm-wince-tdep.c: Sort headers. * arm-tdep.c: Sort headers. * arm-symbian-tdep.c: Sort headers. * arm-pikeos-tdep.c: Sort headers. * arm-obsd-tdep.c: Sort headers. * arm-nbsd-tdep.c: Sort headers. * arm-nbsd-nat.c: Sort headers. * arm-linux-tdep.c: Sort headers. * arm-linux-nat.c: Sort headers. * arm-fbsd-tdep.c: Sort headers. * arm-fbsd-nat.c: Sort headers. * arm-bsd-tdep.c: Sort headers. * arch-utils.c: Sort headers. * arc-tdep.c: Sort headers. * arc-newlib-tdep.c: Sort headers. * annotate.h: Sort headers. * annotate.c: Sort headers. * amd64-windows-tdep.c: Sort headers. * amd64-windows-nat.c: Sort headers. * amd64-tdep.c: Sort headers. * amd64-sol2-tdep.c: Sort headers. * amd64-obsd-tdep.c: Sort headers. * amd64-obsd-nat.c: Sort headers. * amd64-nbsd-tdep.c: Sort headers. * amd64-nbsd-nat.c: Sort headers. * amd64-nat.c: Sort headers. * amd64-linux-tdep.c: Sort headers. * amd64-linux-nat.c: Sort headers. * amd64-fbsd-tdep.c: Sort headers. * amd64-fbsd-nat.c: Sort headers. * amd64-dicos-tdep.c: Sort headers. * amd64-darwin-tdep.c: Sort headers. * amd64-bsd-nat.c: Sort headers. * alpha-tdep.c: Sort headers. * alpha-obsd-tdep.c: Sort headers. * alpha-nbsd-tdep.c: Sort headers. * alpha-mdebug-tdep.c: Sort headers. * alpha-linux-tdep.c: Sort headers. * alpha-linux-nat.c: Sort headers. * alpha-bsd-tdep.c: Sort headers. * alpha-bsd-nat.c: Sort headers. * aix-thread.c: Sort headers. * agent.c: Sort headers. * addrmap.c: Sort headers. * ada-varobj.c: Sort headers. * ada-valprint.c: Sort headers. * ada-typeprint.c: Sort headers. * ada-tasks.c: Sort headers. * ada-lang.c: Sort headers. * aarch64-tdep.c: Sort headers. * aarch64-ravenscar-thread.c: Sort headers. * aarch64-newlib-tdep.c: Sort headers. * aarch64-linux-tdep.c: Sort headers. * aarch64-linux-nat.c: Sort headers. * aarch64-fbsd-tdep.c: Sort headers. * aarch64-fbsd-nat.c: Sort headers. * aarch32-linux-nat.c: Sort headers.
2019-04-03 04:04:24 +02:00
#include "elf/arm.h"
Revert the header-sorting patch Andreas Schwab and John Baldwin pointed out some bugs in the header sorting patch; and I noticed that the output was not correct when limited to a subset of files (a bug in my script). So, I'm reverting the patch. I may try again after fixing the issues pointed out. gdb/ChangeLog 2019-04-05 Tom Tromey <tom@tromey.com> Revert the header-sorting patch. * ft32-tdep.c: Revert. * frv-tdep.c: Revert. * frv-linux-tdep.c: Revert. * frame.c: Revert. * frame-unwind.c: Revert. * frame-base.c: Revert. * fork-child.c: Revert. * findvar.c: Revert. * findcmd.c: Revert. * filesystem.c: Revert. * filename-seen-cache.h: Revert. * filename-seen-cache.c: Revert. * fbsd-tdep.c: Revert. * fbsd-nat.h: Revert. * fbsd-nat.c: Revert. * f-valprint.c: Revert. * f-typeprint.c: Revert. * f-lang.c: Revert. * extension.h: Revert. * extension.c: Revert. * extension-priv.h: Revert. * expprint.c: Revert. * exec.h: Revert. * exec.c: Revert. * exceptions.c: Revert. * event-top.c: Revert. * event-loop.c: Revert. * eval.c: Revert. * elfread.c: Revert. * dwarf2read.h: Revert. * dwarf2read.c: Revert. * dwarf2loc.c: Revert. * dwarf2expr.h: Revert. * dwarf2expr.c: Revert. * dwarf2-frame.c: Revert. * dwarf2-frame-tailcall.c: Revert. * dwarf-index-write.h: Revert. * dwarf-index-write.c: Revert. * dwarf-index-common.c: Revert. * dwarf-index-cache.h: Revert. * dwarf-index-cache.c: Revert. * dummy-frame.c: Revert. * dtrace-probe.c: Revert. * disasm.h: Revert. * disasm.c: Revert. * disasm-selftests.c: Revert. * dictionary.c: Revert. * dicos-tdep.c: Revert. * demangle.c: Revert. * dcache.h: Revert. * dcache.c: Revert. * darwin-nat.h: Revert. * darwin-nat.c: Revert. * darwin-nat-info.c: Revert. * d-valprint.c: Revert. * d-namespace.c: Revert. * d-lang.c: Revert. * ctf.c: Revert. * csky-tdep.c: Revert. * csky-linux-tdep.c: Revert. * cris-tdep.c: Revert. * cris-linux-tdep.c: Revert. * cp-valprint.c: Revert. * cp-support.c: Revert. * cp-namespace.c: Revert. * cp-abi.c: Revert. * corelow.c: Revert. * corefile.c: Revert. * continuations.c: Revert. * completer.h: Revert. * completer.c: Revert. * complaints.c: Revert. * coffread.c: Revert. * coff-pe-read.c: Revert. * cli-out.h: Revert. * cli-out.c: Revert. * charset.c: Revert. * c-varobj.c: Revert. * c-valprint.c: Revert. * c-typeprint.c: Revert. * c-lang.c: Revert. * buildsym.c: Revert. * buildsym-legacy.c: Revert. * build-id.h: Revert. * build-id.c: Revert. * btrace.c: Revert. * bsd-uthread.c: Revert. * breakpoint.h: Revert. * breakpoint.c: Revert. * break-catch-throw.c: Revert. * break-catch-syscall.c: Revert. * break-catch-sig.c: Revert. * blockframe.c: Revert. * block.c: Revert. * bfin-tdep.c: Revert. * bfin-linux-tdep.c: Revert. * bfd-target.c: Revert. * bcache.c: Revert. * ax-general.c: Revert. * ax-gdb.h: Revert. * ax-gdb.c: Revert. * avr-tdep.c: Revert. * auxv.c: Revert. * auto-load.c: Revert. * arm-wince-tdep.c: Revert. * arm-tdep.c: Revert. * arm-symbian-tdep.c: Revert. * arm-pikeos-tdep.c: Revert. * arm-obsd-tdep.c: Revert. * arm-nbsd-tdep.c: Revert. * arm-nbsd-nat.c: Revert. * arm-linux-tdep.c: Revert. * arm-linux-nat.c: Revert. * arm-fbsd-tdep.c: Revert. * arm-fbsd-nat.c: Revert. * arm-bsd-tdep.c: Revert. * arch-utils.c: Revert. * arc-tdep.c: Revert. * arc-newlib-tdep.c: Revert. * annotate.h: Revert. * annotate.c: Revert. * amd64-windows-tdep.c: Revert. * amd64-windows-nat.c: Revert. * amd64-tdep.c: Revert. * amd64-sol2-tdep.c: Revert. * amd64-obsd-tdep.c: Revert. * amd64-obsd-nat.c: Revert. * amd64-nbsd-tdep.c: Revert. * amd64-nbsd-nat.c: Revert. * amd64-nat.c: Revert. * amd64-linux-tdep.c: Revert. * amd64-linux-nat.c: Revert. * amd64-fbsd-tdep.c: Revert. * amd64-fbsd-nat.c: Revert. * amd64-dicos-tdep.c: Revert. * amd64-darwin-tdep.c: Revert. * amd64-bsd-nat.c: Revert. * alpha-tdep.c: Revert. * alpha-obsd-tdep.c: Revert. * alpha-nbsd-tdep.c: Revert. * alpha-mdebug-tdep.c: Revert. * alpha-linux-tdep.c: Revert. * alpha-linux-nat.c: Revert. * alpha-bsd-tdep.c: Revert. * alpha-bsd-nat.c: Revert. * aix-thread.c: Revert. * agent.c: Revert. * addrmap.c: Revert. * ada-varobj.c: Revert. * ada-valprint.c: Revert. * ada-typeprint.c: Revert. * ada-tasks.c: Revert. * ada-lang.c: Revert. * aarch64-tdep.c: Revert. * aarch64-ravenscar-thread.c: Revert. * aarch64-newlib-tdep.c: Revert. * aarch64-linux-tdep.c: Revert. * aarch64-linux-nat.c: Revert. * aarch64-fbsd-tdep.c: Revert. * aarch64-fbsd-nat.c: Revert. * aarch32-linux-nat.c: Revert.
2019-04-06 21:38:10 +02:00
#include "record.h"
#include "record-full.h"
#include <algorithm>
#if GDB_SELF_TEST
Rename common to gdbsupport This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
2019-05-06 04:29:24 +02:00
#include "gdbsupport/selftest.h"
#endif
Change boolean options to bool instead of int This is for add_setshow_boolean_cmd as well as the gdb::option interface. gdb/ChangeLog: 2019-09-17 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_ignore_descriptive_types_p): Change to bool. (print_signatures): Likewise. (trust_pad_over_xvs): Likewise. * arch/aarch64-insn.c (aarch64_debug): Likewise. * arch/aarch64-insn.h (aarch64_debug): Likewise. * arm-linux-nat.c (arm_apcs_32): Likewise. * arm-linux-tdep.c (arm_apcs_32): Likewise. * arm-nbsd-nat.c (arm_apcs_32): Likewise. * arm-tdep.c (arm_debug): Likewise. (arm_apcs_32): Likewise. * auto-load.c (debug_auto_load): Likewise. (auto_load_gdb_scripts): Likewise. (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * auto-load.h (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * breakpoint.c (disconnected_dprintf): Likewise. (breakpoint_proceeded): Likewise. (automatic_hardware_breakpoints): Likewise. (always_inserted_mode): Likewise. (target_exact_watchpoints): Likewise. (_initialize_breakpoint): Update. * breakpoint.h (target_exact_watchpoints): Change to bool. * btrace.c (maint_btrace_pt_skip_pad): Likewise. * cli/cli-cmds.c (trace_commands): Likewise. * cli/cli-cmds.h (trace_commands): Likewise. * cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument to bool*. * cli/cli-logging.c (logging_overwrite): Change to bool. (logging_redirect): Likewise. (debug_redirect): Likewise. * cli/cli-option.h (option_def) <boolean>: Change return type to bool*. (struct boolean_option_def) <get_var_address_cb_>: Change return type to bool. <boolean_option_def>: Update. (struct flag_option_def): Change default type of Context to bool from int. <flag_option_def>: Change return type of var_address_cb_ to bool*. * cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*. (get_setshow_command_value_string): Likewise. * cli/cli-style.c (cli_styling): Change to bool. (source_styling): Likewise. * cli/cli-style.h (source_styling): Likewise. (cli_styling): Likewise. * cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change to bool. * command.h (var_types): Update comment. (add_setshow_boolean_cmd): Change int* var argument to bool*. * compile/compile-cplus-types.c (debug_compile_cplus_types): Change to bool. (debug_compile_cplus_scopes): Likewise. * compile/compile-internal.h (compile_debug): Likewise. * compile/compile.c (compile_debug): Likewise. (struct compile_options) <raw>: Likewise. * cp-support.c (catch_demangler_crashes): Likewise. * cris-tdep.c (usr_cmd_cris_version_valid): Likewise. (usr_cmd_cris_dwarf2_cfi): Likewise. * csky-tdep.c (csky_debug): Likewise. * darwin-nat.c (enable_mach_exceptions): Likewise. * dcache.c (dcache_enabled_p): Likewise. * defs.h (info_verbose): Likewise. * demangle.c (demangle): Likewise. (asm_demangle): Likewise. * dwarf-index-cache.c (debug_index_cache): Likewise. * dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2read.c (check_physname): Likewise. (use_deprecated_index_sections): Likewise. (dwarf_always_disassemble): Likewise. * eval.c (overload_resolution): Likewise. * event-top.c (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * event-top.h (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * exec.c (write_files): Likewise. * fbsd-nat.c (debug_fbsd_lwp): Likewise (debug_fbsd_nat): Likewise. * frame.h (struct frame_print_options) <print_raw_frame_arguments>: Likewise. (struct set_backtrace_options) <backtrace_past_main>: Likewise. <backtrace_past_entry> Likewise. * gdb-demangle.h (demangle): Likewise. (asm_demangle): Likewise. * gdb_bfd.c (bfd_sharing): Likewise. * gdbcore.h (write_files): Likewise. * gdbsupport/common-debug.c (show_debug_regs): Likewise. * gdbsupport/common-debug.h (show_debug_regs): Likewise. * gdbthread.h (print_thread_events): Likewise. * gdbtypes.c (opaque_type_resolution): Likewise. (strict_type_checking): Likewise. * gnu-nat.c (gnu_debug_flag): Likewise. * guile/scm-auto-load.c (auto_load_guile_scripts): Likewise. * guile/scm-param.c (pascm_variable): Add boolval. (add_setshow_generic): Update. (pascm_param_value): Update. (pascm_set_param_value_x): Update. * hppa-tdep.c (hppa_debug): Change to bool.. * infcall.c (may_call_functions_p): Likewise. (coerce_float_to_double_p): Likewise. (unwind_on_signal_p): Likewise. (unwind_on_terminating_exception_p): Likewise. * infcmd.c (startup_with_shell): Likewise. * inferior.c (print_inferior_events): Likewise. * inferior.h (startup_with_shell): Likewise. (print_inferior_events): Likewise. * infrun.c (step_stop_if_no_debug): Likewise. (detach_fork): Likewise. (debug_displaced): Likewise. (disable_randomization): Likewise. (non_stop): Likewise. (non_stop_1): Likewise. (observer_mode): Likewise. (observer_mode_1): Likewise. (set_observer_mode): Update. (sched_multi): Change to bool. * infrun.h (debug_displaced): Likewise. (sched_multi): Likewise. (step_stop_if_no_debug): Likewise. (non_stop): Likewise. (disable_randomization): Likewise. * linux-tdep.c (use_coredump_filter): Likewise. (dump_excluded_mappings): Likewise. * linux-thread-db.c (auto_load_thread_db): Likewise. (check_thread_db_on_load): Likewise. * main.c (captured_main_1): Update. * maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt, xx2_opt, boolean_opt>: Change to bool. * maint-test-settings.c (maintenance_test_settings_boolean): Likewise. * maint.c (maintenance_profile_p): Likewise. (per_command_time): Likewise. (per_command_space): Likewise. (per_command_symtab): Likewise. * memattr.c (inaccessible_by_default): Likewise. * mi/mi-main.c (mi_async): Likewise. (mi_async_1): Likewise. * mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise. * nat/fork-inferior.h (startup_with_shell): Likewise. * nat/linux-namespaces.c (debug_linux_namespaces): Likewise. * nat/linux-namespaces.h (debug_linux_namespaces): Likewise. * nios2-tdep.c (nios2_debug): Likewise. * or1k-tdep.c (or1k_debug): Likewise. * parse.c (parser_debug): Likewise. * parser-defs.h (parser_debug): Likewise. * printcmd.c (print_symbol_filename): Likewise. * proc-api.c (procfs_trace): Likewise. * python/py-auto-load.c (auto_load_python_scripts): Likewise. * python/py-param.c (union parmpy_variable): Add "bool boolval" field. (set_parameter_value): Update. (add_setshow_generic): Update. * python/py-value.c (copy_py_bool_obj): Change argument from int* to bool*. * python/python.c (gdbpy_parameter_value): Cast to bool* instead of int*. * ravenscar-thread.c (ravenscar_task_support): Change to bool. * record-btrace.c (record_btrace_target::store_registers): Update. * record-full.c (record_full_memory_query): Change to bool. (record_full_stop_at_limit): Likewise. * record-full.h (record_full_memory_query): Likewise. * remote-notif.c (notif_debug): Likewise. * remote-notif.h (notif_debug): Likewise. * remote.c (use_range_stepping): Likewise. (interrupt_on_connect): Likewise. (remote_break): Likewise. * ser-tcp.c (tcp_auto_retry): Likewise. * ser-unix.c (serial_hwflow): Likewise. * skip.c (debug_skip): Likewise. * solib-aix.c (solib_aix_debug): Likewise. * spu-tdep.c (spu_stop_on_load_p): Likewise. (spu_auto_flush_cache_p): Likewise. * stack.c (struct backtrace_cmd_options) <full, no_filters, hide>: Likewise. (struct info_print_options) <quiet>: Likewise. * symfile-debug.c (debug_symfile): Likewise. * symfile.c (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symfile.h (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symtab.c (basenames_may_differ): Likewise. (struct filename_partial_match_opts) <dirname, basename>: Likewise. (struct info_print_options) <quiet, exclude_minsyms>: Likewise. (struct info_types_options) <quiet>: Likewise. * symtab.h (demangle): Likewise. (basenames_may_differ): Likewise. * target-dcache.c (stack_cache_enabled_1): Likewise. (code_cache_enabled_1): Likewise. * target.c (trust_readonly): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. (auto_connect_native_target): Likewise. (target_stop_and_wait): Update. (target_async_permitted): Change to bool. (target_async_permitted_1): Likewise. (may_write_registers_1): Likewise. (may_write_memory_1): Likewise. (may_insert_breakpoints_1): Likewise. (may_insert_tracepoints_1): Likewise. (may_insert_fast_tracepoints_1): Likewise. (may_stop_1): Likewise. * target.h (target_async_permitted): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. * thread.c (struct info_threads_opts) <show_global_ids>: Likewise. (make_thread_apply_all_options_def_group): Change argument from int* to bool*. (thread_apply_all_command): Update. (print_thread_events): Change to bool. * top.c (confirm): Likewise. (command_editing_p): Likewise. (history_expansion_p): Likewise. (write_history_p): Likewise. (info_verbose): Likewise. * top.h (confirm): Likewise. (history_expansion_p): Likewise. * tracepoint.c (disconnected_tracing): Likewise. (circular_trace_buffer): Likewise. * typeprint.c (print_methods): Likewise. (print_typedefs): Likewise. * utils.c (debug_timestamp): Likewise. (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * utils.h (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * valops.c (overload_resolution): Likewise. * valprint.h (struct value_print_options) <prettyformat_arrays, prettyformat_structs, vtblprint, unionprint, addressprint, objectprint, stop_print_at_null, print_array_indexes, deref_ref, static_field_print, pascal_static_field_print, raw, summary, symbol_print, finish_print>: Likewise. * windows-nat.c (new_console): Likewise. (cygwin_exceptions): Likewise. (new_group): Likewise. (debug_exec): Likewise. (debug_events): Likewise. (debug_memory): Likewise. (debug_exceptions): Likewise. (useshell): Likewise. * windows-tdep.c (maint_display_all_tib): Likewise. * xml-support.c (debug_xml): Likewise.
2019-09-14 21:36:58 +02:00
static bool arm_debug;
/* Macros for setting and testing a bit in a minimal symbol that marks
it as Thumb function. The MSB of the minimal symbol's "info" field
is used for this purpose.
MSYMBOL_SET_SPECIAL Actually sets the "special" bit.
MSYMBOL_IS_SPECIAL Tests the "special" bit in a minimal symbol. */
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
#define MSYMBOL_SET_SPECIAL(msym) \
MSYMBOL_TARGET_FLAG_1 (msym) = 1
#define MSYMBOL_IS_SPECIAL(msym) \
MSYMBOL_TARGET_FLAG_1 (msym)
struct arm_mapping_symbol
{
CORE_ADDR value;
char type;
bool operator< (const arm_mapping_symbol &other) const
{ return this->value < other.value; }
};
typedef std::vector<arm_mapping_symbol> arm_mapping_symbol_vec;
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
struct arm_per_bfd
{
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
explicit arm_per_bfd (size_t num_sections)
arm-tdep: sort mapping symbols after parsing all minimal symbols Somebody on IRC reported a while ago that loading a big ARM program in GDB was very slow. Their profiling pointed out that a big amount of time was spent in VEC_safe_insert (arm_mapping_symbol_s, *map_p, idx, &new_map_sym); I was able to verify this as well. ARM mapping symbols are special ELF symbols named $a, $d and $t indicating that symbols starting at this address up to the next mapping symbol (in terms of address) are of type "ARM code", "data" and "Thumb code", respectively. GDB records these symbols in vectors (one for each section) in arm-tdep.c. These vectors are sorted by symbol address, to allow for quick lookup. The current approach is to insert new symbols at the right position to keep the vectors sorted at all time. This is done based on the assumption that mapping symbols come already almost sorted from the binary, as explains this comment in arm_record_special_symbol: /* Assume that most mapping symbols appear in order of increasing value. If they were randomly distributed, it would be faster to always push here and then sort at first use. */ Well, it turns out this is not the case. The original reporter mentioned that mapping symbols in their binaries are not nearly sorted, and this is not my experience either (at least in the binary used in the benchmark below). So if the values don't come nearly sorted, doing insertions to keep the vectors sorted ends up being of the order of number_of_mapping_symbols ^ 2. This patch changes it just like the comment above says, to just append to the vector in arm_record_special_symbol and sort the vector on first use. Benchmark ========= I have done some benchmarks using an --enable-targets=all GDB, compiled with -O2, running on x86-64 and parsing file dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug from this package: https://launchpad.net/ubuntu/+source/firefox/66.0.3+build1-0ubuntu1/+build/16608691/+files/firefox-dbg_66.0.3+build1-0ubuntu1_armhf.deb This file is the separate debug info for libxul.so (part of firefox) for ARM. I have added some traces to measure the execution time of just elf_symtab_read and ran GDB like this: ./gdb --data-directory=data-directory -nx -batch .../path/to/usr/lib/debug/.build-id/65/dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug Since the new code sorts the vectors on first use, it would be difficult to benchmark it as-is and be fair, since the "before" version does more work in elf_symtab_read. So I have actually benchmarked a version of the patch that did sort all the vectors at the end of elf_symtab_read, so the sorting would be considered in the measured execution time. Here's the measured execution time of elf_symtab_read, averaged on 3 runs: insert sorted (before): 28.678s sort after (after): 1.760s And here's the total execution time of the command above (just one run). The time is now mostly spent in reading DWARF. insert sorted: 71.12s user 2.71s system 99% cpu 1:14.03 total sort after: 46.42s user 2.60s system 99% cpu 49.147 total I tried for fun on my Raspberry Pi 3, the run time of elf_symtab_read goes from ~259s to ~9s, reading the same file. gdb/ChangeLog: * arm-tdep.c (struct arm_per_objfile) <section_maps_sorted>: New field. (arm_find_mapping_symbol): Sort mapping symbol vectors on first use. (arm_record_special_symbol): Don't insert new symbol in sorted position, push it at the end.
2019-06-25 20:22:30 +02:00
: section_maps (new arm_mapping_symbol_vec[num_sections]),
section_maps_sorted (new bool[num_sections] ())
{}
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
DISABLE_COPY_AND_ASSIGN (arm_per_bfd);
/* Information about mapping symbols ($a, $d, $t) in the objfile.
The format is an array of vectors of arm_mapping_symbols, there is one
vector for each section of the objfile (the array is index by BFD section
index).
For each section, the vector of arm_mapping_symbol is sorted by
symbol value (address). */
std::unique_ptr<arm_mapping_symbol_vec[]> section_maps;
arm-tdep: sort mapping symbols after parsing all minimal symbols Somebody on IRC reported a while ago that loading a big ARM program in GDB was very slow. Their profiling pointed out that a big amount of time was spent in VEC_safe_insert (arm_mapping_symbol_s, *map_p, idx, &new_map_sym); I was able to verify this as well. ARM mapping symbols are special ELF symbols named $a, $d and $t indicating that symbols starting at this address up to the next mapping symbol (in terms of address) are of type "ARM code", "data" and "Thumb code", respectively. GDB records these symbols in vectors (one for each section) in arm-tdep.c. These vectors are sorted by symbol address, to allow for quick lookup. The current approach is to insert new symbols at the right position to keep the vectors sorted at all time. This is done based on the assumption that mapping symbols come already almost sorted from the binary, as explains this comment in arm_record_special_symbol: /* Assume that most mapping symbols appear in order of increasing value. If they were randomly distributed, it would be faster to always push here and then sort at first use. */ Well, it turns out this is not the case. The original reporter mentioned that mapping symbols in their binaries are not nearly sorted, and this is not my experience either (at least in the binary used in the benchmark below). So if the values don't come nearly sorted, doing insertions to keep the vectors sorted ends up being of the order of number_of_mapping_symbols ^ 2. This patch changes it just like the comment above says, to just append to the vector in arm_record_special_symbol and sort the vector on first use. Benchmark ========= I have done some benchmarks using an --enable-targets=all GDB, compiled with -O2, running on x86-64 and parsing file dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug from this package: https://launchpad.net/ubuntu/+source/firefox/66.0.3+build1-0ubuntu1/+build/16608691/+files/firefox-dbg_66.0.3+build1-0ubuntu1_armhf.deb This file is the separate debug info for libxul.so (part of firefox) for ARM. I have added some traces to measure the execution time of just elf_symtab_read and ran GDB like this: ./gdb --data-directory=data-directory -nx -batch .../path/to/usr/lib/debug/.build-id/65/dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug Since the new code sorts the vectors on first use, it would be difficult to benchmark it as-is and be fair, since the "before" version does more work in elf_symtab_read. So I have actually benchmarked a version of the patch that did sort all the vectors at the end of elf_symtab_read, so the sorting would be considered in the measured execution time. Here's the measured execution time of elf_symtab_read, averaged on 3 runs: insert sorted (before): 28.678s sort after (after): 1.760s And here's the total execution time of the command above (just one run). The time is now mostly spent in reading DWARF. insert sorted: 71.12s user 2.71s system 99% cpu 1:14.03 total sort after: 46.42s user 2.60s system 99% cpu 49.147 total I tried for fun on my Raspberry Pi 3, the run time of elf_symtab_read goes from ~259s to ~9s, reading the same file. gdb/ChangeLog: * arm-tdep.c (struct arm_per_objfile) <section_maps_sorted>: New field. (arm_find_mapping_symbol): Sort mapping symbol vectors on first use. (arm_record_special_symbol): Don't insert new symbol in sorted position, push it at the end.
2019-06-25 20:22:30 +02:00
/* For each corresponding element of section_maps above, is this vector
sorted. */
std::unique_ptr<bool[]> section_maps_sorted;
};
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
/* Per-bfd data used for mapping symbols. */
static bfd_key<arm_per_bfd> arm_bfd_data_key;
/* The list of available "set arm ..." and "show arm ..." commands. */
static struct cmd_list_element *setarmcmdlist = NULL;
static struct cmd_list_element *showarmcmdlist = NULL;
/* The type of floating-point to use. Keep this in sync with enum
arm_float_model, and the help string in _initialize_arm_tdep. */
gdb/ Code cleanup: Make 1440 bytes of data segment read-only. * arch-utils.c (endian_enum): Make it const char *const []. * arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings): Likewise. * breakpoint.c (always_inserted_enums): Likewise. * cli/cli-cmds.c (script_ext_enums): Likewise. * cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the enumlist parameter const char *const *. * cli/cli-decode.h (struct cmd_list_element): Make the enums field const char *const *. * command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist parameter const char *const *. * cris-tdep.c (cris_modes): Make it const char *const []. * filesystem.c (target_file_system_kinds): Likewise. * i386-tdep.c (valid_flavors, valid_conventions): Likewise. * infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names) (can_use_displaced_stepping_enum, scheduler_enums) (exec_direction_names): Likewise. * language.c (_initialize_language): Make the type_or_range_names and case_sensitive_names variables const char *const []. * mips-tdep.c (mips_abi_strings): Make it const char *const []. * python/python.c (python_excp_enums): Likewise. * remote.c (interrupt_sequence_modes): Likewise. * rs6000-tdep.c (powerpc_vector_strings): Likewise. * serial.c (logbase_enums): Likewise. * sh-tdep.c (sh_cc_enum): Likewise. * stack.c (print_frame_arguments_choices, print_entry_values_choices): Likewise. * symtab.c (multiple_symbols_modes): Likewise. * tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums): Likewise. * utils.c (internal_problem_modes): Likewise.
2012-01-28 19:08:22 +01:00
static const char *const fp_model_strings[] =
{
"auto",
"softfpa",
"fpa",
"softvfp",
"vfp",
NULL
};
/* A variable that can be configured by the user. */
static enum arm_float_model arm_fp_model = ARM_FLOAT_AUTO;
static const char *current_fp_model = "auto";
/* The ABI to use. Keep this in sync with arm_abi_kind. */
gdb/ Code cleanup: Make 1440 bytes of data segment read-only. * arch-utils.c (endian_enum): Make it const char *const []. * arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings): Likewise. * breakpoint.c (always_inserted_enums): Likewise. * cli/cli-cmds.c (script_ext_enums): Likewise. * cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the enumlist parameter const char *const *. * cli/cli-decode.h (struct cmd_list_element): Make the enums field const char *const *. * command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist parameter const char *const *. * cris-tdep.c (cris_modes): Make it const char *const []. * filesystem.c (target_file_system_kinds): Likewise. * i386-tdep.c (valid_flavors, valid_conventions): Likewise. * infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names) (can_use_displaced_stepping_enum, scheduler_enums) (exec_direction_names): Likewise. * language.c (_initialize_language): Make the type_or_range_names and case_sensitive_names variables const char *const []. * mips-tdep.c (mips_abi_strings): Make it const char *const []. * python/python.c (python_excp_enums): Likewise. * remote.c (interrupt_sequence_modes): Likewise. * rs6000-tdep.c (powerpc_vector_strings): Likewise. * serial.c (logbase_enums): Likewise. * sh-tdep.c (sh_cc_enum): Likewise. * stack.c (print_frame_arguments_choices, print_entry_values_choices): Likewise. * symtab.c (multiple_symbols_modes): Likewise. * tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums): Likewise. * utils.c (internal_problem_modes): Likewise.
2012-01-28 19:08:22 +01:00
static const char *const arm_abi_strings[] =
{
"auto",
"APCS",
"AAPCS",
NULL
};
/* A variable that can be configured by the user. */
static enum arm_abi_kind arm_abi_global = ARM_ABI_AUTO;
static const char *arm_abi_string = "auto";
/* The execution mode to assume. */
gdb/ Code cleanup: Make 1440 bytes of data segment read-only. * arch-utils.c (endian_enum): Make it const char *const []. * arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings): Likewise. * breakpoint.c (always_inserted_enums): Likewise. * cli/cli-cmds.c (script_ext_enums): Likewise. * cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the enumlist parameter const char *const *. * cli/cli-decode.h (struct cmd_list_element): Make the enums field const char *const *. * command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist parameter const char *const *. * cris-tdep.c (cris_modes): Make it const char *const []. * filesystem.c (target_file_system_kinds): Likewise. * i386-tdep.c (valid_flavors, valid_conventions): Likewise. * infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names) (can_use_displaced_stepping_enum, scheduler_enums) (exec_direction_names): Likewise. * language.c (_initialize_language): Make the type_or_range_names and case_sensitive_names variables const char *const []. * mips-tdep.c (mips_abi_strings): Make it const char *const []. * python/python.c (python_excp_enums): Likewise. * remote.c (interrupt_sequence_modes): Likewise. * rs6000-tdep.c (powerpc_vector_strings): Likewise. * serial.c (logbase_enums): Likewise. * sh-tdep.c (sh_cc_enum): Likewise. * stack.c (print_frame_arguments_choices, print_entry_values_choices): Likewise. * symtab.c (multiple_symbols_modes): Likewise. * tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums): Likewise. * utils.c (internal_problem_modes): Likewise.
2012-01-28 19:08:22 +01:00
static const char *const arm_mode_strings[] =
{
"auto",
"arm",
"thumb",
NULL
};
static const char *arm_fallback_mode_string = "auto";
static const char *arm_force_mode_string = "auto";
/* The standard register names, and all the valid aliases for them. Note
that `fp', `sp' and `pc' are not added in this alias list, because they
have been added as builtin user registers in
std-regs.c:_initialize_frame_reg. */
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
static const struct
{
const char *name;
int regnum;
} arm_register_aliases[] = {
/* Basic register numbers. */
{ "r0", 0 },
{ "r1", 1 },
{ "r2", 2 },
{ "r3", 3 },
{ "r4", 4 },
{ "r5", 5 },
{ "r6", 6 },
{ "r7", 7 },
{ "r8", 8 },
{ "r9", 9 },
{ "r10", 10 },
{ "r11", 11 },
{ "r12", 12 },
{ "r13", 13 },
{ "r14", 14 },
{ "r15", 15 },
/* Synonyms (argument and variable registers). */
{ "a1", 0 },
{ "a2", 1 },
{ "a3", 2 },
{ "a4", 3 },
{ "v1", 4 },
{ "v2", 5 },
{ "v3", 6 },
{ "v4", 7 },
{ "v5", 8 },
{ "v6", 9 },
{ "v7", 10 },
{ "v8", 11 },
/* Other platform-specific names for r9. */
{ "sb", 9 },
{ "tr", 9 },
/* Special names. */
{ "ip", 12 },
{ "lr", 14 },
/* Names used by GCC (not listed in the ARM EABI). */
{ "sl", 10 },
/* A special name from the older ATPCS. */
{ "wr", 7 },
};
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
static const char *const arm_register_names[] =
2000-02-01 04:19:29 +01:00
{"r0", "r1", "r2", "r3", /* 0 1 2 3 */
"r4", "r5", "r6", "r7", /* 4 5 6 7 */
"r8", "r9", "r10", "r11", /* 8 9 10 11 */
"r12", "sp", "lr", "pc", /* 12 13 14 15 */
"f0", "f1", "f2", "f3", /* 16 17 18 19 */
"f4", "f5", "f6", "f7", /* 20 21 22 23 */
"fps", "cpsr" }; /* 24 25 */
1999-12-22 22:45:38 +01:00
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
/* Holds the current set of options to be passed to the disassembler. */
static char *arm_disassembler_options;
/* Valid register name styles. */
static const char **valid_disassembly_styles;
1999-12-22 22:45:38 +01:00
/* Disassembly style to use. Default to "std" register names. */
static const char *disassembly_style;
1999-08-09 23:36:23 +02:00
/* All possible arm target descriptors. */
static struct target_desc *tdesc_arm_list[ARM_FP_TYPE_INVALID];
static struct target_desc *tdesc_arm_mprofile_list[ARM_M_TYPE_INVALID];
1999-12-22 22:45:38 +01:00
/* This is used to keep the bfd arch_info in sync with the disassembly
style. */
Constify add_setshow_* This constifies the add_setshow_* family of functions, and then fixes up the fallout. The bulk of this patch was written by script. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * ada-lang.c (catch_ada_exception_command): Constify. (catch_assert_command): Constify. * break-catch-throw.c (catch_catch_command, catch_throw_command) (catch_rethrow_command): Constify. (catch_exception_command_1): Constify. * breakpoint.h (add_catch_command): Constify. * break-catch-syscall.c (catch_syscall_command_1): Constify. (catch_syscall_split_args): Constify. * break-catch-sig.c (catch_signal_command): Constify. (catch_signal_split_args): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Use cmd_const_sfunc_ftype. * cli/cli-decode.c (add_setshow_cmd_full): Constify. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, struct cmd_list_element) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd): Constify. (set_cmd_sfunc): Constify. (empty_sfunc): Constify. * command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Constify. (set_cmd_sfunc): Constify. (cmd_sfunc_ftype): Remove. * compile/compile.c (set_compile_args): Constify. * infrun.c (set_disable_randomization): Constify. * infcmd.c (set_args_command, set_cwd_command): Constify. * breakpoint.c (set_condition_evaluation_mode): Constify. (add_catch_command): Constify. (catch_fork_command_1, catch_exec_command_1) (catch_load_command_1, catch_unload_command_1): Constify. (catch_load_or_unload): Constify. * guile/scm-param.c (pascm_set_func): Constify. (add_setshow_generic): Constify. * python/py-param.c (get_set_value): Constify. * top.h (set_verbose): Constify. * tui/tui-win.c (tui_set_var_cmd): Constify. * mi/mi-main.c (set_mi_async_command): Constify. * cli/cli-logging.c (set_logging_overwrite) (set_logging_redirect): Constify. * value.c (set_max_value_size): Constify. * valprint.c (set_input_radix, set_output_radix): Constify. * utils.c (set_width_command, set_height_command): Constify. * typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify. * tracepoint.c (set_disconnected_tracing) (set_circular_trace_buffer, set_trace_buffer_size) (set_trace_user, set_trace_notes, set_trace_stop_notes): Constify. * top.c (set_history_size_command, set_verbose, set_editing) (set_gdb_datadir, set_history_filename): Constify. * target.c (set_targetdebug, maint_set_target_async_command) (maint_set_target_non_stop_command, set_target_permissions) (set_write_memory_permission): Constify. (open_target): Constify. * target-descriptions.c (set_tdesc_filename_cmd): Constify. * target-dcache.c (set_stack_cache, set_code_cache): Constify. * symtab.c (set_symbol_cache_size_handler): Constify. * symfile.c (set_ext_lang_command): Constify. * symfile-debug.c (set_debug_symfile): Constify. * source.c (set_directories_command): Constify. * solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify. * serial.c (set_parity): Constify. * rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify. * remote.c (set_remote_exec_file, set_remotebreak) (set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify. * record.c (set_record_insn_history_size) (set_record_call_history_size): Constify. * record-full.c (set_record_full_insn_max_num): Constify. * proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify. * osabi.c (set_osabi): Constify. * mips-tdep.c (set_mips64_transfers_32bit_regs) (reinit_frame_cache_sfunc, mips_abi_update): Constify. * maint.c (maintenance_set_profile_cmd): Constify. * linux-thread-db.c (set_libthread_db_search_path): Constify. * language.c (set_language_command, set_range_command) (set_case_command): Constify. * infrun.c (set_non_stop, set_observer_mode) (set_stop_on_solib_events, set_schedlock_func) (set_exec_direction_func): Constify. * infcmd.c (set_inferior_tty_command): Constify. * disasm.c (set_disassembler_options_sfunc): Constify. * demangle.c (set_demangling_command): Constify. * dcache.c (set_dcache_size, set_dcache_line_size): Constify. * cris-tdep.c (set_cris_version, set_cris_mode) (set_cris_dwarf2_cfi): Constify. * corefile.c (set_gnutarget_command): Constify. * charset.c (set_host_charset_sfunc, set_target_charset_sfunc) (set_target_wide_charset_sfunc): Constify. * breakpoint.c (update_dprintf_commands): Constify. * auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify. * arm-tdep.c (set_fp_model_sfunc, arm_set_abi) (set_disassembly_style_sfunc): Constify. * arch-utils.c (set_endian, set_architecture): Constify. * alpha-tdep.c (reinit_frame_cache_sfunc): Constify. * agent.c (set_can_use_agent): Constify.
2017-10-14 17:07:00 +02:00
static void set_disassembly_style_sfunc (const char *, int,
1999-12-22 22:45:38 +01:00
struct cmd_list_element *);
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
static void show_disassembly_style_sfunc (struct ui_file *, int,
struct cmd_list_element *,
const char *);
1999-12-22 22:45:38 +01:00
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
static enum register_status arm_neon_quad_read (struct gdbarch *gdbarch,
class readable_regcache and pass readable_regcache to gdbarch pseudo_register_read and pseudo_register_read_value pseudo registers are either from raw registers or memory, so gdbarch methods pseudo_register_read and pseudo_register_read_value should have regcache object which only have read methods. In other words, we should disallow writing to regcache in these two gdbarch methods. In order to apply this restriction, this patch adds a new class readable_regcache, derived from reg_buffer, and it only has raw_read and cooked_read methods. regcache is derived from readable_regcache. This patch also passes readable_regcache instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. This patch moves raw_read* and cooked_read* methods to readable_regcache, which is straightforward. One thing not straightforward is that I split regcache::xfer_part to readable_regcache::read_part and regcache::write_part, because readable_regcache can only have methods to read. readable_regcache is an abstract base class, and it has a pure virtual function raw_update, because I don't want readable_regcache know where these raw registers are from. They can be from either the target (readwrite regcache) or the regcache itself (readonly regcache). gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_register_read_value): Change parameter type to 'readable_regcache *'. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. (arm_pseudo_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * gdbarch.c: Re-generated. * gdbarch.h: Re-generated. * gdbarch.sh (pseudo_register_read): Change parameter type to 'readable_regcache *'. (pseudo_register_read_value): Likewise. * h8300-tdep.c (pseudo_from_raw_register): Likewise. (h8300_pseudo_register_read): Likewise. * hppa-tdep.c (hppa_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. (i386_pseudo_register_read_value): Likewise. * i386-tdep.h (i386_pseudo_register_read_into_value): Update declaration. * ia64-tdep.c (ia64_pseudo_register_read): Likewise. * m32c-tdep.c (m32c_raw_read): Likewise. (m32c_read_flg): Likewise. (m32c_banked_register): Likewise. (m32c_banked_read): Likewise. (m32c_sb_read): Likewise. (m32c_part_read): Likewise. (m32c_cat_read): Likewise. (m32c_r3r2r1r0_read): Likewise. (m32c_pseudo_register_read): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_register_read): Likewise. * mips-tdep.c (mips_pseudo_register_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * regcache.c (regcache::raw_read): Move it to readable_regcache. (regcache::cooked_read): Likewise. (regcache::cooked_read_value): Likewise. (regcache_cooked_read_signed): (regcache::cooked_read): Likewise. * regcache.h (readable_regcache): New class. (regcache): Inherit readable_regcache. Move some methods to readable_regcache. * rl78-tdep.c (rl78_pseudo_register_read): Change parameter type to 'readable_regcache *'. * rs6000-tdep.c (do_regcache_raw_read): Remove. (e500_pseudo_register_read): Change parameter type to 'readable_regcache *'. (dfp_pseudo_register_read): Likewise. (vsx_pseudo_register_read): Likewise. (efpr_pseudo_register_read): Likewise. * s390-tdep.c (s390_pseudo_register_read): Likewise. * sh-tdep.c (sh_pseudo_register_read): Likewise. * sh64-tdep.c (pseudo_register_read_portions): Likewise. (sh64_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. (spu_pseudo_register_read): Likewise. * xtensa-tdep.c (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Likewise.
2018-02-21 12:20:03 +01:00
readable_regcache *regcache,
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
int regnum, gdb_byte *buf);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
static void arm_neon_quad_write (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum, const gdb_byte *buf);
static CORE_ADDR
arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self);
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* get_next_pcs operations. */
static struct arm_get_next_pcs_ops arm_get_next_pcs_ops = {
arm_get_next_pcs_read_memory_unsigned_integer,
arm_get_next_pcs_syscall_next_pc,
arm_get_next_pcs_addr_bits_remove,
[ARM] Fixup PC in software single step When I exercise GDBserver software single step, I see the following error, which has been already handled by GDB properly. In GDBserver log, we can see, GDBserver tries to single step instruction on 0xb6e0a6e4, and destination address is 0xffff0fe0, stop pc is 0xb6e0a6e4 Writing f001f0e7 to 0xffff0fe0 in process 7132 Failed to insert breakpoint at 0xffff0fe0 (Input/output error). Failed to insert breakpoint at 0xffff0fe0 (-1). (gdb) disassemble __aeabi_read_tp,+8 Dump of assembler code from 0xb6e0a6e0 to 0xb6e0a6e8: 0xb6e0a6e0 <__aeabi_read_tp+0>: mvn r0, #61440 ; 0xf000 0xb6e0a6e4 <__aeabi_read_tp+4>: sub pc, r0, #31 however, it fails inserting breakpoint there. This problem has already fixed by GDB, see comments in arm-linux-tdep.c:arm_linux_software_single_step /* The Linux kernel offers some user-mode helpers in a high page. We can not read this page (as of 2.6.23), and even if we could then we couldn't set breakpoints in it, and even if we could then the atomic operations would fail when interrupted. They are all called as functions and return to the address in LR, so step to there instead. */ so we need to do the same thing in GDB side as well. This patch adds a new field fixup in arm_get_next_pcs_ops, so that we can fix up PC for arm-linux target. In this way, both GDB and GDBserver can single step instructions going to kernel helpers. gdb: 2016-02-12 Yao Qi <yao.qi@linaro.org> * arch/arm-get-next-pcs.c (arm_get_next_pcs): Call self->ops->fixup if it isn't NULL. * arch/arm-get-next-pcs.h: Include gdb_vecs.h. (struct arm_get_next_pcs_ops) <fixup>: New field. * arch/arm-linux.c: Include common-regcache.h and arch/arm-get-next-pcs.h. (arm_linux_get_next_pcs_fixup): New function. * arch/arm-linux.h (arm_linux_get_next_pcs_fixup): Declare. * arm-linux-tdep.c (arm_linux_get_next_pcs_ops): Initialize it with arm_linux_get_next_pcs_fixup. (arm_linux_software_single_step): Move code to arm_linux_get_next_pcs_fixup. * arm-tdep.c (arm_get_next_pcs_ops): Initialize it. gdb/gdbserver: 2016-02-12 Yao Qi <yao.qi@linaro.org> * linux-arm-low.c (get_next_pcs_ops): Initialize it with arm_linux_get_next_pcs_fixup.
2016-02-08 17:05:31 +01:00
arm_get_next_pcs_is_thumb,
NULL,
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
};
struct arm_prologue_cache
{
/* The stack pointer at the time this frame was created; i.e. the
caller's stack pointer when this function was called. It is used
to identify this frame. */
CORE_ADDR prev_sp;
/* The frame base for this frame is just prev_sp - frame size.
FRAMESIZE is the distance from the frame pointer to the
initial stack pointer. */
int framesize;
/* The register used to hold the frame pointer for this frame. */
int framereg;
/* Saved register offsets. */
struct trad_frame_saved_reg *saved_regs;
};
1999-12-22 22:45:38 +01:00
static CORE_ADDR arm_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR prologue_start,
CORE_ADDR prologue_end,
struct arm_prologue_cache *cache);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Architecture version for displaced stepping. This effects the behaviour of
certain instructions, and really should not be hard-wired. */
#define DISPLACED_STEPPING_ARCH_VERSION 5
/* See arm-tdep.h. */
Change boolean options to bool instead of int This is for add_setshow_boolean_cmd as well as the gdb::option interface. gdb/ChangeLog: 2019-09-17 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_ignore_descriptive_types_p): Change to bool. (print_signatures): Likewise. (trust_pad_over_xvs): Likewise. * arch/aarch64-insn.c (aarch64_debug): Likewise. * arch/aarch64-insn.h (aarch64_debug): Likewise. * arm-linux-nat.c (arm_apcs_32): Likewise. * arm-linux-tdep.c (arm_apcs_32): Likewise. * arm-nbsd-nat.c (arm_apcs_32): Likewise. * arm-tdep.c (arm_debug): Likewise. (arm_apcs_32): Likewise. * auto-load.c (debug_auto_load): Likewise. (auto_load_gdb_scripts): Likewise. (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * auto-load.h (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * breakpoint.c (disconnected_dprintf): Likewise. (breakpoint_proceeded): Likewise. (automatic_hardware_breakpoints): Likewise. (always_inserted_mode): Likewise. (target_exact_watchpoints): Likewise. (_initialize_breakpoint): Update. * breakpoint.h (target_exact_watchpoints): Change to bool. * btrace.c (maint_btrace_pt_skip_pad): Likewise. * cli/cli-cmds.c (trace_commands): Likewise. * cli/cli-cmds.h (trace_commands): Likewise. * cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument to bool*. * cli/cli-logging.c (logging_overwrite): Change to bool. (logging_redirect): Likewise. (debug_redirect): Likewise. * cli/cli-option.h (option_def) <boolean>: Change return type to bool*. (struct boolean_option_def) <get_var_address_cb_>: Change return type to bool. <boolean_option_def>: Update. (struct flag_option_def): Change default type of Context to bool from int. <flag_option_def>: Change return type of var_address_cb_ to bool*. * cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*. (get_setshow_command_value_string): Likewise. * cli/cli-style.c (cli_styling): Change to bool. (source_styling): Likewise. * cli/cli-style.h (source_styling): Likewise. (cli_styling): Likewise. * cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change to bool. * command.h (var_types): Update comment. (add_setshow_boolean_cmd): Change int* var argument to bool*. * compile/compile-cplus-types.c (debug_compile_cplus_types): Change to bool. (debug_compile_cplus_scopes): Likewise. * compile/compile-internal.h (compile_debug): Likewise. * compile/compile.c (compile_debug): Likewise. (struct compile_options) <raw>: Likewise. * cp-support.c (catch_demangler_crashes): Likewise. * cris-tdep.c (usr_cmd_cris_version_valid): Likewise. (usr_cmd_cris_dwarf2_cfi): Likewise. * csky-tdep.c (csky_debug): Likewise. * darwin-nat.c (enable_mach_exceptions): Likewise. * dcache.c (dcache_enabled_p): Likewise. * defs.h (info_verbose): Likewise. * demangle.c (demangle): Likewise. (asm_demangle): Likewise. * dwarf-index-cache.c (debug_index_cache): Likewise. * dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2read.c (check_physname): Likewise. (use_deprecated_index_sections): Likewise. (dwarf_always_disassemble): Likewise. * eval.c (overload_resolution): Likewise. * event-top.c (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * event-top.h (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * exec.c (write_files): Likewise. * fbsd-nat.c (debug_fbsd_lwp): Likewise (debug_fbsd_nat): Likewise. * frame.h (struct frame_print_options) <print_raw_frame_arguments>: Likewise. (struct set_backtrace_options) <backtrace_past_main>: Likewise. <backtrace_past_entry> Likewise. * gdb-demangle.h (demangle): Likewise. (asm_demangle): Likewise. * gdb_bfd.c (bfd_sharing): Likewise. * gdbcore.h (write_files): Likewise. * gdbsupport/common-debug.c (show_debug_regs): Likewise. * gdbsupport/common-debug.h (show_debug_regs): Likewise. * gdbthread.h (print_thread_events): Likewise. * gdbtypes.c (opaque_type_resolution): Likewise. (strict_type_checking): Likewise. * gnu-nat.c (gnu_debug_flag): Likewise. * guile/scm-auto-load.c (auto_load_guile_scripts): Likewise. * guile/scm-param.c (pascm_variable): Add boolval. (add_setshow_generic): Update. (pascm_param_value): Update. (pascm_set_param_value_x): Update. * hppa-tdep.c (hppa_debug): Change to bool.. * infcall.c (may_call_functions_p): Likewise. (coerce_float_to_double_p): Likewise. (unwind_on_signal_p): Likewise. (unwind_on_terminating_exception_p): Likewise. * infcmd.c (startup_with_shell): Likewise. * inferior.c (print_inferior_events): Likewise. * inferior.h (startup_with_shell): Likewise. (print_inferior_events): Likewise. * infrun.c (step_stop_if_no_debug): Likewise. (detach_fork): Likewise. (debug_displaced): Likewise. (disable_randomization): Likewise. (non_stop): Likewise. (non_stop_1): Likewise. (observer_mode): Likewise. (observer_mode_1): Likewise. (set_observer_mode): Update. (sched_multi): Change to bool. * infrun.h (debug_displaced): Likewise. (sched_multi): Likewise. (step_stop_if_no_debug): Likewise. (non_stop): Likewise. (disable_randomization): Likewise. * linux-tdep.c (use_coredump_filter): Likewise. (dump_excluded_mappings): Likewise. * linux-thread-db.c (auto_load_thread_db): Likewise. (check_thread_db_on_load): Likewise. * main.c (captured_main_1): Update. * maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt, xx2_opt, boolean_opt>: Change to bool. * maint-test-settings.c (maintenance_test_settings_boolean): Likewise. * maint.c (maintenance_profile_p): Likewise. (per_command_time): Likewise. (per_command_space): Likewise. (per_command_symtab): Likewise. * memattr.c (inaccessible_by_default): Likewise. * mi/mi-main.c (mi_async): Likewise. (mi_async_1): Likewise. * mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise. * nat/fork-inferior.h (startup_with_shell): Likewise. * nat/linux-namespaces.c (debug_linux_namespaces): Likewise. * nat/linux-namespaces.h (debug_linux_namespaces): Likewise. * nios2-tdep.c (nios2_debug): Likewise. * or1k-tdep.c (or1k_debug): Likewise. * parse.c (parser_debug): Likewise. * parser-defs.h (parser_debug): Likewise. * printcmd.c (print_symbol_filename): Likewise. * proc-api.c (procfs_trace): Likewise. * python/py-auto-load.c (auto_load_python_scripts): Likewise. * python/py-param.c (union parmpy_variable): Add "bool boolval" field. (set_parameter_value): Update. (add_setshow_generic): Update. * python/py-value.c (copy_py_bool_obj): Change argument from int* to bool*. * python/python.c (gdbpy_parameter_value): Cast to bool* instead of int*. * ravenscar-thread.c (ravenscar_task_support): Change to bool. * record-btrace.c (record_btrace_target::store_registers): Update. * record-full.c (record_full_memory_query): Change to bool. (record_full_stop_at_limit): Likewise. * record-full.h (record_full_memory_query): Likewise. * remote-notif.c (notif_debug): Likewise. * remote-notif.h (notif_debug): Likewise. * remote.c (use_range_stepping): Likewise. (interrupt_on_connect): Likewise. (remote_break): Likewise. * ser-tcp.c (tcp_auto_retry): Likewise. * ser-unix.c (serial_hwflow): Likewise. * skip.c (debug_skip): Likewise. * solib-aix.c (solib_aix_debug): Likewise. * spu-tdep.c (spu_stop_on_load_p): Likewise. (spu_auto_flush_cache_p): Likewise. * stack.c (struct backtrace_cmd_options) <full, no_filters, hide>: Likewise. (struct info_print_options) <quiet>: Likewise. * symfile-debug.c (debug_symfile): Likewise. * symfile.c (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symfile.h (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symtab.c (basenames_may_differ): Likewise. (struct filename_partial_match_opts) <dirname, basename>: Likewise. (struct info_print_options) <quiet, exclude_minsyms>: Likewise. (struct info_types_options) <quiet>: Likewise. * symtab.h (demangle): Likewise. (basenames_may_differ): Likewise. * target-dcache.c (stack_cache_enabled_1): Likewise. (code_cache_enabled_1): Likewise. * target.c (trust_readonly): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. (auto_connect_native_target): Likewise. (target_stop_and_wait): Update. (target_async_permitted): Change to bool. (target_async_permitted_1): Likewise. (may_write_registers_1): Likewise. (may_write_memory_1): Likewise. (may_insert_breakpoints_1): Likewise. (may_insert_tracepoints_1): Likewise. (may_insert_fast_tracepoints_1): Likewise. (may_stop_1): Likewise. * target.h (target_async_permitted): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. * thread.c (struct info_threads_opts) <show_global_ids>: Likewise. (make_thread_apply_all_options_def_group): Change argument from int* to bool*. (thread_apply_all_command): Update. (print_thread_events): Change to bool. * top.c (confirm): Likewise. (command_editing_p): Likewise. (history_expansion_p): Likewise. (write_history_p): Likewise. (info_verbose): Likewise. * top.h (confirm): Likewise. (history_expansion_p): Likewise. * tracepoint.c (disconnected_tracing): Likewise. (circular_trace_buffer): Likewise. * typeprint.c (print_methods): Likewise. (print_typedefs): Likewise. * utils.c (debug_timestamp): Likewise. (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * utils.h (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * valops.c (overload_resolution): Likewise. * valprint.h (struct value_print_options) <prettyformat_arrays, prettyformat_structs, vtblprint, unionprint, addressprint, objectprint, stop_print_at_null, print_array_indexes, deref_ref, static_field_print, pascal_static_field_print, raw, summary, symbol_print, finish_print>: Likewise. * windows-nat.c (new_console): Likewise. (cygwin_exceptions): Likewise. (new_group): Likewise. (debug_exec): Likewise. (debug_events): Likewise. (debug_memory): Likewise. (debug_exceptions): Likewise. (useshell): Likewise. * windows-tdep.c (maint_display_all_tib): Likewise. * xml-support.c (debug_xml): Likewise.
2019-09-14 21:36:58 +02:00
bool arm_apcs_32 = true;
/* Return the bit mask in ARM_PS_REGNUM that indicates Thumb mode. */
int
arm_psr_thumb_bit (struct gdbarch *gdbarch)
{
if (gdbarch_tdep (gdbarch)->is_m)
return XPSR_T;
else
return CPSR_T;
}
Refactor arm_software_single_step to use regcache This patch is in preparation for software single step support on ARM in GDBServer. It refactors arm_*_software_single_step and sub-functions to use regcache instead of frame to access registers so that the code can be shared more easily between GDB and GDBServer. Note also that since the intention is at some point to get rid of frame completely in that function, memory reads have also been replaced by read_memory_unsigned_integer rather than get_frame_memory_unsigned. No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * arm-linux-tdep.c (arm_linux_sigreturn_next_pc_offset): New function. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_syscall_next_pc): Use regcache instead of frame. (arm_linux_software_single_step): Likewise. * arm-tdep.c (arm_is_thumb): New function. (shifted_reg_va): Use regcache instead of frame. (thumb_get_next_pc_raw): Likewise. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_software_single_step): Likewise. * arm-tdep.h (struct gdbarch_tdep): Use regcache for syscall_next_pc. (arm_get_next_pc): Use regcache. (arm_deal_with_atomic_sequence): Likewise. (arm_is_thumb): New declaration. * regcache.c (regcache_raw_get_unsigned): New function. * regcache.h (regcache_raw_get_unsigned): New function declaration.
2015-12-18 17:33:59 +01:00
/* Determine if the processor is currently executing in Thumb mode. */
int
arm_is_thumb (struct regcache *regcache)
{
ULONGEST cpsr;
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
ULONGEST t_bit = arm_psr_thumb_bit (regcache->arch ());
Refactor arm_software_single_step to use regcache This patch is in preparation for software single step support on ARM in GDBServer. It refactors arm_*_software_single_step and sub-functions to use regcache instead of frame to access registers so that the code can be shared more easily between GDB and GDBServer. Note also that since the intention is at some point to get rid of frame completely in that function, memory reads have also been replaced by read_memory_unsigned_integer rather than get_frame_memory_unsigned. No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * arm-linux-tdep.c (arm_linux_sigreturn_next_pc_offset): New function. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_syscall_next_pc): Use regcache instead of frame. (arm_linux_software_single_step): Likewise. * arm-tdep.c (arm_is_thumb): New function. (shifted_reg_va): Use regcache instead of frame. (thumb_get_next_pc_raw): Likewise. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_software_single_step): Likewise. * arm-tdep.h (struct gdbarch_tdep): Use regcache for syscall_next_pc. (arm_get_next_pc): Use regcache. (arm_deal_with_atomic_sequence): Likewise. (arm_is_thumb): New declaration. * regcache.c (regcache_raw_get_unsigned): New function. * regcache.h (regcache_raw_get_unsigned): New function declaration.
2015-12-18 17:33:59 +01:00
cpsr = regcache_raw_get_unsigned (regcache, ARM_PS_REGNUM);
return (cpsr & t_bit) != 0;
}
/* Determine if FRAME is executing in Thumb mode. */
int
arm_frame_is_thumb (struct frame_info *frame)
{
CORE_ADDR cpsr;
ULONGEST t_bit = arm_psr_thumb_bit (get_frame_arch (frame));
/* Every ARM frame unwinder can unwind the T bit of the CPSR, either
directly (from a signal frame or dummy frame) or by interpreting
the saved LR (from a prologue or DWARF frame). So consult it and
trust the unwinders. */
cpsr = get_frame_register_unsigned (frame, ARM_PS_REGNUM);
return (cpsr & t_bit) != 0;
}
/* Search for the mapping symbol covering MEMADDR. If one is found,
return its type. Otherwise, return 0. If START is non-NULL,
set *START to the location of the mapping symbol. */
static char
arm_find_mapping_symbol (CORE_ADDR memaddr, CORE_ADDR *start)
{
struct obj_section *sec;
/* If there are mapping symbols, consult them. */
sec = find_pc_section (memaddr);
if (sec != NULL)
{
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
arm_per_bfd *data = arm_bfd_data_key.get (sec->objfile->obfd);
if (data != NULL)
{
arm-tdep: sort mapping symbols after parsing all minimal symbols Somebody on IRC reported a while ago that loading a big ARM program in GDB was very slow. Their profiling pointed out that a big amount of time was spent in VEC_safe_insert (arm_mapping_symbol_s, *map_p, idx, &new_map_sym); I was able to verify this as well. ARM mapping symbols are special ELF symbols named $a, $d and $t indicating that symbols starting at this address up to the next mapping symbol (in terms of address) are of type "ARM code", "data" and "Thumb code", respectively. GDB records these symbols in vectors (one for each section) in arm-tdep.c. These vectors are sorted by symbol address, to allow for quick lookup. The current approach is to insert new symbols at the right position to keep the vectors sorted at all time. This is done based on the assumption that mapping symbols come already almost sorted from the binary, as explains this comment in arm_record_special_symbol: /* Assume that most mapping symbols appear in order of increasing value. If they were randomly distributed, it would be faster to always push here and then sort at first use. */ Well, it turns out this is not the case. The original reporter mentioned that mapping symbols in their binaries are not nearly sorted, and this is not my experience either (at least in the binary used in the benchmark below). So if the values don't come nearly sorted, doing insertions to keep the vectors sorted ends up being of the order of number_of_mapping_symbols ^ 2. This patch changes it just like the comment above says, to just append to the vector in arm_record_special_symbol and sort the vector on first use. Benchmark ========= I have done some benchmarks using an --enable-targets=all GDB, compiled with -O2, running on x86-64 and parsing file dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug from this package: https://launchpad.net/ubuntu/+source/firefox/66.0.3+build1-0ubuntu1/+build/16608691/+files/firefox-dbg_66.0.3+build1-0ubuntu1_armhf.deb This file is the separate debug info for libxul.so (part of firefox) for ARM. I have added some traces to measure the execution time of just elf_symtab_read and ran GDB like this: ./gdb --data-directory=data-directory -nx -batch .../path/to/usr/lib/debug/.build-id/65/dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug Since the new code sorts the vectors on first use, it would be difficult to benchmark it as-is and be fair, since the "before" version does more work in elf_symtab_read. So I have actually benchmarked a version of the patch that did sort all the vectors at the end of elf_symtab_read, so the sorting would be considered in the measured execution time. Here's the measured execution time of elf_symtab_read, averaged on 3 runs: insert sorted (before): 28.678s sort after (after): 1.760s And here's the total execution time of the command above (just one run). The time is now mostly spent in reading DWARF. insert sorted: 71.12s user 2.71s system 99% cpu 1:14.03 total sort after: 46.42s user 2.60s system 99% cpu 49.147 total I tried for fun on my Raspberry Pi 3, the run time of elf_symtab_read goes from ~259s to ~9s, reading the same file. gdb/ChangeLog: * arm-tdep.c (struct arm_per_objfile) <section_maps_sorted>: New field. (arm_find_mapping_symbol): Sort mapping symbol vectors on first use. (arm_record_special_symbol): Don't insert new symbol in sorted position, push it at the end.
2019-06-25 20:22:30 +02:00
unsigned int section_idx = sec->the_bfd_section->index;
arm_mapping_symbol_vec &map
= data->section_maps[section_idx];
/* Sort the vector on first use. */
if (!data->section_maps_sorted[section_idx])
{
std::sort (map.begin (), map.end ());
data->section_maps_sorted[section_idx] = true;
}
struct arm_mapping_symbol map_key
= { memaddr - obj_section_addr (sec), 0 };
arm_mapping_symbol_vec::const_iterator it
= std::lower_bound (map.begin (), map.end (), map_key);
/* std::lower_bound finds the earliest ordered insertion
point. If the symbol at this position starts at this exact
address, we use that; otherwise, the preceding
mapping symbol covers this address. */
if (it < map.end ())
{
if (it->value == map_key.value)
{
if (start)
*start = it->value + obj_section_addr (sec);
return it->type;
}
}
if (it > map.begin ())
{
arm_mapping_symbol_vec::const_iterator prev_it
= it - 1;
if (start)
*start = prev_it->value + obj_section_addr (sec);
return prev_it->type;
}
}
}
return 0;
}
/* Determine if the program counter specified in MEMADDR is in a Thumb
function. This function should be called for addresses unrelated to
any executing frame; otherwise, prefer arm_frame_is_thumb. */
ChangeLog: * arm-linux-nat.c: Include "observer.h" and "gdbthread.h". (PTRACE_GETHBPREGS, PTRACE_SETHBPREGS): Define. (struct arm_linux_hwbp_cap): New type. (arm_linux_get_hwbp_cap): New function. (arm_linux_get_hw_breakpoint_count): Likewise. (arm_linux_get_hw_watchpoint_count): Likewise. (arm_linux_can_use_hw_breakpoint): Likewise. (arm_hwbp_type): New type. (arm_hwbp_control_t): Likewise. (struct arm_linux_hw_breakpoint): Likewise. (struct arm_linux_thread_points): Likewise. (arm_threads): New global variable. (arm_linux_find_breakpoints_by_tid): New function. (arm_hwbp_control_initialize): Likewise. (arm_hwbp_control_is_enabled): Likewise. (arm_hwbp_control_disable): Likewise. (arm_linux_hw_breakpoint_initialize): Likewise. (arm_linux_get_hwbp_type): Likewise. (arm_linux_hw_watchpoint_initialize): Likewise. (arm_linux_hw_breakpoint_equal): Likewise. (arm_linux_insert_hw_breakpoint1): Likewise. (arm_linux_remove_hw_breakpoint1): Likewise. (arm_linux_insert_hw_breakpoint): Likewise. (arm_linux_remove_hw_breakpoint): Likewise. (arm_linux_region_ok_for_hw_watchpoint): Likewise. (arm_linux_insert_watchpoint): Likewise. (arm_linux_remove_watchpoint): Likewise. (arm_linux_stopped_data_address): Likewise. (arm_linux_stopped_by_watchpoint): Likewise. (arm_linux_watchpoint_addr_within_range): Likewise. (arm_linux_new_thread): Likewise. (arm_linux_thread_exit): Likewise. (_initialize_arm_linux_nat): Install hardware breakpoint/watchpoint related target callbacks. Register arm_linux_new_thread and arm_linux_thread_exit. * arm-tdep.h (arm_pc_is_thumb): Add prototype. * arm-tdep.c (arm_pc_is_thumb): Make global. (arm_gdbarch_init): Call set_gdbarch_have_nonsteppable_watchpoint. testsuite/ChangeLog: * lib/gdb.exp (skip_hw_breakpoint_tests): Add arm*-*-* target. (skip_hw_watchpoint_tests): Likewise. (skip_hw_watchpoint_multi_tests): Likewise.
2011-02-21 16:03:38 +01:00
int
arm_pc_is_thumb (struct gdbarch *gdbarch, CORE_ADDR memaddr)
{
struct bound_minimal_symbol sym;
char type;
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc
= ((arm_displaced_step_closure * )
get_displaced_step_closure_by_addr (memaddr));
/* If checking the mode of displaced instruction in copy area, the mode
should be determined by instruction on the original address. */
if (dsc)
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: check mode of %.8lx instead of %.8lx\n",
(unsigned long) dsc->insn_addr,
(unsigned long) memaddr);
memaddr = dsc->insn_addr;
}
/* If bit 0 of the address is set, assume this is a Thumb address. */
if (IS_THUMB_ADDR (memaddr))
return 1;
/* If the user wants to override the symbol table, let him. */
if (strcmp (arm_force_mode_string, "arm") == 0)
return 0;
if (strcmp (arm_force_mode_string, "thumb") == 0)
return 1;
/* ARM v6-M and v7-M are always in Thumb mode. */
if (gdbarch_tdep (gdbarch)->is_m)
return 1;
/* If there are mapping symbols, consult them. */
type = arm_find_mapping_symbol (memaddr, NULL);
if (type)
return type == 't';
1999-12-22 22:45:38 +01:00
/* Thumb functions have a "special" bit set in minimal symbols. */
sym = lookup_minimal_symbol_by_pc (memaddr);
if (sym.minsym)
return (MSYMBOL_IS_SPECIAL (sym.minsym));
/* If the user wants to override the fallback mode, let them. */
if (strcmp (arm_fallback_mode_string, "arm") == 0)
return 0;
if (strcmp (arm_fallback_mode_string, "thumb") == 0)
return 1;
/* If we couldn't find any symbol, but we're talking to a running
target, then trust the current value of $cpsr. This lets
"display/i $pc" always show the correct mode (though if there is
a symbol table we will not reach here, so it still may not be
displayed in the mode it will be executed). */
if (target_has_registers)
return arm_frame_is_thumb (get_current_frame ());
/* Otherwise we're out of luck; we assume ARM. */
return 0;
}
/* Determine if the address specified equals any of these magic return
values, called EXC_RETURN, defined by the ARM v6-M and v7-M
architectures.
From ARMv6-M Reference Manual B1.5.8
Table B1-5 Exception return behavior
EXC_RETURN Return To Return Stack
0xFFFFFFF1 Handler mode Main
0xFFFFFFF9 Thread mode Main
0xFFFFFFFD Thread mode Process
From ARMv7-M Reference Manual B1.5.8
Table B1-8 EXC_RETURN definition of exception return behavior, no FP
EXC_RETURN Return To Return Stack
0xFFFFFFF1 Handler mode Main
0xFFFFFFF9 Thread mode Main
0xFFFFFFFD Thread mode Process
Table B1-9 EXC_RETURN definition of exception return behavior, with
FP
EXC_RETURN Return To Return Stack Frame Type
0xFFFFFFE1 Handler mode Main Extended
0xFFFFFFE9 Thread mode Main Extended
0xFFFFFFED Thread mode Process Extended
0xFFFFFFF1 Handler mode Main Basic
0xFFFFFFF9 Thread mode Main Basic
0xFFFFFFFD Thread mode Process Basic
For more details see "B1.5.8 Exception return behavior"
in both ARMv6-M and ARMv7-M Architecture Reference Manuals. */
static int
arm_m_addr_is_magic (CORE_ADDR addr)
{
switch (addr)
{
/* Values from Tables in B1.5.8 the EXC_RETURN definitions of
the exception return behavior. */
case 0xffffffe1:
case 0xffffffe9:
case 0xffffffed:
case 0xfffffff1:
case 0xfffffff9:
case 0xfffffffd:
/* Address is magic. */
return 1;
default:
/* Address is not magic. */
return 0;
}
}
/* Remove useless bits from addresses in a running program. */
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
static CORE_ADDR
arm_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val)
{
/* On M-profile devices, do not strip the low bit from EXC_RETURN
(the magic exception return address). */
if (gdbarch_tdep (gdbarch)->is_m
&& arm_m_addr_is_magic (val))
return val;
if (arm_apcs_32)
return UNMAKE_THUMB_ADDR (val);
else
return (val & 0x03fffffc);
}
/* Return 1 if PC is the start of a compiler helper function which
can be safely ignored during prologue skipping. IS_THUMB is true
if the function is known to be a Thumb function due to the way it
is being called. */
static int
skip_prologue_function (struct gdbarch *gdbarch, CORE_ADDR pc, int is_thumb)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
struct bound_minimal_symbol msym;
msym = lookup_minimal_symbol_by_pc (pc);
if (msym.minsym != NULL
start change to progspace independence This patch starts changing minimal symbols to be independent of the program space. Specifically, it adds a new objfile parameter to MSYMBOL_VALUE_ADDRESS and changes all the code to use it. This is needed so we can change gdb to apply the section offset when a minsym's address is computed, as opposed to baking the offsets into the symbol itself. A few spots still need the unrelocated address. For these, we introduce MSYMBOL_VALUE_RAW_ADDRESS. As a convenience, we also add the new macro BMSYMBOL_VALUE_ADDRESS, which computes the address of a bound minimal symbol. This just does the obvious thing with the fields. Note that this change does not actually enable program space independence. That requires more changes to gdb. However, to ensure that these changes compile properly, this patch does add the needed section lookup code to MSYMBOL_VALUE_ADDRESS -- it just ensures it has no effect at runtime by multiplying the offset by 0. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_main_name): Update. (ada_add_standard_exceptions): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (skip_prologue_function, arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * blockframe.c (get_pc_function_start) (find_pc_partial_function_gnu_ifunc): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-valprint.c (c_val_print): Update. * coff-pe-read.c (add_pe_forwarded_sym): Update. * common/agent.c (agent_look_up_symbols): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * dwarf2read.c (dw2_find_pc_sect_symtab): Update. * elfread.c (elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Update. * findvar.c (default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence) (hppa_hpux_find_dummy_bpaddr): Update. * hppa-tdep.c (hppa_symbol_address): Update. * infcmd.c (until_next_command): Update. * jit.c (jit_read_descriptor, jit_breakpoint_re_set_internal): Update. * linespec.c (minsym_found, add_minsym): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update. * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (lookup_minimal_symbol_by_pc_name): Update. (frob_address): New function. (lookup_minimal_symbol_by_pc_section_1): Use raw addresses, frob_address. Rename parameter to "pc_in". (compare_minimal_symbols, compact_minimal_symbols): Use raw addresses. (find_solib_trampoline_target, minimal_symbol_upper_bound): Update. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * mips-tdep.c (mips_skip_pic_trampoline_code): Update. * objc-lang.c (find_objc_msgsend): Update. * objfiles.c (objfile_relocate1): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-valprint.c (pascal_val_print): Update. * parse.c (write_exp_msymbol): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup) (ppc_elfv2_skip_entrypoint): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic, msym_info) (address_info): Update. * proc-service.c (ps_pglobal_lookup): Update. * psymtab.c (find_pc_sect_psymtab_closer) (find_pc_sect_psymtab, find_pc_sect_symtab_from_partial): Change msymbol parameter to bound_minimal_symbol. * ravenscar-thread.c (get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sh64-tdep.c (sh64_elf_make_msymbol_special): Use raw address. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, main_got): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (link_map_start): Update. * solib-spu.c (spu_enable_break, ocl_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol, scan_file_globals): Update. * stack.c (find_frame_funname): Update. * symfile-debug.c (debug_qf_expand_symtabs_matching) (debug_qf_find_pc_sect_symtab): Update. * symfile.c (simple_read_overlay_table) (simple_overlay_update): Update. * symfile.h (struct quick_symbol_functions) <find_pc_sect_symtab>: Change type of msymbol to bound_minimal_symbol. * symmisc.c (dump_msymbols): Update. * symtab.c (find_pc_sect_symtab_via_partial) (find_pc_sect_psymtab, find_pc_sect_line, skip_prologue_sal) (search_symbols, print_msymbol_info): Update. * symtab.h (MSYMBOL_VALUE_RAW_ADDRESS): New macro. (MSYMBOL_VALUE_ADDRESS): Redefine. (BMSYMBOL_VALUE_ADDRESS): New macro. * tracepoint.c (scope_info): Update. * tui/tui-disasm.c (tui_find_disassembly_address) (tui_get_begin_asm_address): Update. * valops.c (find_function_in_inferior): Update. * value.c (value_static_field, value_fn_field): Update.
2013-08-15 16:46:35 +02:00
&& BMSYMBOL_VALUE_ADDRESS (msym) == pc
Replace the MSYMBOL_*_NAME macros with member functions Improves readability. In the future, it will also allow making the name private, once the name setter functions become member functions. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_lookup_simple_minsym): Update. (ada_collect_symbol_completion_matches): Update. * ada-tasks.c (read_atcb): Update. * amd64-windows-tdep.c (amd64_skip_main_prologue): Update. (amd64_windows_skip_trampoline_code): Update. * arm-tdep.c (skip_prologue_function): Update. (arm_skip_stack_protector): Update. * arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update. (arm_wince_skip_main_prologue): Update. * ax-gdb.c (gen_expr): Update. * block.c (call_site_for_pc): Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (set_breakpoint_location_function): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * c-valprint.c (print_unpacked_pointer): Update. * coffread.c (coff_symfile_read): Update. * compile/compile-c-symbols.c (convert_symbol_bmsym): Update. * compile/compile-cplus-symbols.c (convert_symbol_bmsym): Update. * dwarf-index-write.c (write_psymbols): Update. * dwarf2loc.c (call_site_to_target_addr): Update. (func_verify_no_selftailcall): Update. (tailcall_dump): Update. (call_site_find_chain_1): Update. (dwarf_expr_reg_to_entry_parameter): Update. * elfread.c (elf_gnu_ifunc_record_cache): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. (evaluate_subexp_for_sizeof): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * frame.c (get_prev_frame_always_1): Update. * frv-tdep.c (frv_skip_main_prologue): Update. * gnu-v2-abi.c (gnuv2_value_rtti_type): Update. * gnu-v3-abi.c (gnuv3_rtti_type): Update. (gnuv3_get_typename_from_type_info): Update. (gnuv3_skip_trampoline): Update. * hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update. * i386-tdep.c (i386_skip_main_prologue): Update. (i386_pe_skip_trampoline_code): Update. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update. * infcall.c (get_function_name): Update. * linespec.c (minsym_found): Update. * linux-fork.c (info_checkpoints_command): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. (m32c_m16c_pointer_to_address): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (add_minsym_to_hash_table): Update. (add_minsym_to_demangled_hash_table): Update. (lookup_minimal_symbol_mangled): Update. (lookup_minimal_symbol_demangled): Update. (lookup_minimal_symbol_linkage): Update. (lookup_minimal_symbol_text): Update. (lookup_minimal_symbol_by_pc_name): Update. (minimal_symbol_is_less_than): Update. (compact_minimal_symbols): Update. (build_minimal_symbol_hash_tables): Update. (find_solib_trampoline_target): Update. * mips-tdep.c (mips_stub_frame_sniffer): Update. (mips_skip_pic_trampoline_code): Update. * msp430-tdep.c (msp430_skip_trampoline_code): Update. * objc-lang.c (info_selectors_command): Update. (info_classes_command): Update. (find_methods): Update. (find_imps): Update. * p-valprint.c (pascal_val_print): Update. * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic): Update. (info_symbol_command): Update. * psymtab.c (psymbol_name_matches): Update. (match_partial_symbol): Update. (lookup_partial_symbol): Update. (print_partial_symbols): Update. (sort_pst_symbols): Update. (maintenance_check_psymtabs): Update. * python/py-framefilter.c (py_print_frame): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rs6000-tdep.c (rs6000_skip_main_prologue): Update. (rs6000_skip_trampoline_code): Update. * sol-thread.c (info_cb): Update. * stabsread.c (scan_file_globals): Update. * stack.c (find_frame_funname): Update. (info_frame_command_core): Update. * symmisc.c (dump_msymbols): Update. * symtab.c (symbol_natural_name): Rename to.., (general_symbol_info::natural_name): ...this. (symbol_demangled_name): Rename to... (general_symbol_info::demangled_name): ...this. (symbol_search_name): Rename to... (general_symbol_info::search_name): ...this. (symbol_matches_search_name): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (search_symbols): Update. (print_msymbol_info): Update. (rbreak_command): Update. (completion_list_add_msymbol): Update. (completion_list_objc_symbol): Update. (get_msymbol_address): Update. * symtab.h (struct general_symbol_info): Add member functions natural_name (), linkage_name (), print_name (), demangled_name (), and search_name (). (SYMBOL_NATURAL_NAME): Update. (symbol_natural_name): Move to a member function on general_symbol_info. (SYMBOL_DEMANGLED_NAME): Update. (symbol_demangled_name): Move to a member function on general_symbol_info. (SYMBOL_SEARCH_NAME): Update. (symbol_search_name): Move to a member function on general_symbol_info. (MSYMBOL_NATURAL_NAME): Remove. (MSYMBOL_LINKAGE_NAME): Remove. (MSYMBOL_PRINT_NAME): Remove. (MSYMBOL_DEMANGLED_NAME): Remove. (MSYMBOL_SEARCH_NAME): Remove. * x86-tdep.c (x86_in_indirect_branch_thunk): Update. Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee
2019-11-22 19:05:14 +01:00
&& msym.minsym->linkage_name () != NULL)
{
Replace the MSYMBOL_*_NAME macros with member functions Improves readability. In the future, it will also allow making the name private, once the name setter functions become member functions. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_lookup_simple_minsym): Update. (ada_collect_symbol_completion_matches): Update. * ada-tasks.c (read_atcb): Update. * amd64-windows-tdep.c (amd64_skip_main_prologue): Update. (amd64_windows_skip_trampoline_code): Update. * arm-tdep.c (skip_prologue_function): Update. (arm_skip_stack_protector): Update. * arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update. (arm_wince_skip_main_prologue): Update. * ax-gdb.c (gen_expr): Update. * block.c (call_site_for_pc): Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (set_breakpoint_location_function): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * c-valprint.c (print_unpacked_pointer): Update. * coffread.c (coff_symfile_read): Update. * compile/compile-c-symbols.c (convert_symbol_bmsym): Update. * compile/compile-cplus-symbols.c (convert_symbol_bmsym): Update. * dwarf-index-write.c (write_psymbols): Update. * dwarf2loc.c (call_site_to_target_addr): Update. (func_verify_no_selftailcall): Update. (tailcall_dump): Update. (call_site_find_chain_1): Update. (dwarf_expr_reg_to_entry_parameter): Update. * elfread.c (elf_gnu_ifunc_record_cache): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. (evaluate_subexp_for_sizeof): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * frame.c (get_prev_frame_always_1): Update. * frv-tdep.c (frv_skip_main_prologue): Update. * gnu-v2-abi.c (gnuv2_value_rtti_type): Update. * gnu-v3-abi.c (gnuv3_rtti_type): Update. (gnuv3_get_typename_from_type_info): Update. (gnuv3_skip_trampoline): Update. * hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update. * i386-tdep.c (i386_skip_main_prologue): Update. (i386_pe_skip_trampoline_code): Update. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update. * infcall.c (get_function_name): Update. * linespec.c (minsym_found): Update. * linux-fork.c (info_checkpoints_command): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. (m32c_m16c_pointer_to_address): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (add_minsym_to_hash_table): Update. (add_minsym_to_demangled_hash_table): Update. (lookup_minimal_symbol_mangled): Update. (lookup_minimal_symbol_demangled): Update. (lookup_minimal_symbol_linkage): Update. (lookup_minimal_symbol_text): Update. (lookup_minimal_symbol_by_pc_name): Update. (minimal_symbol_is_less_than): Update. (compact_minimal_symbols): Update. (build_minimal_symbol_hash_tables): Update. (find_solib_trampoline_target): Update. * mips-tdep.c (mips_stub_frame_sniffer): Update. (mips_skip_pic_trampoline_code): Update. * msp430-tdep.c (msp430_skip_trampoline_code): Update. * objc-lang.c (info_selectors_command): Update. (info_classes_command): Update. (find_methods): Update. (find_imps): Update. * p-valprint.c (pascal_val_print): Update. * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic): Update. (info_symbol_command): Update. * psymtab.c (psymbol_name_matches): Update. (match_partial_symbol): Update. (lookup_partial_symbol): Update. (print_partial_symbols): Update. (sort_pst_symbols): Update. (maintenance_check_psymtabs): Update. * python/py-framefilter.c (py_print_frame): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rs6000-tdep.c (rs6000_skip_main_prologue): Update. (rs6000_skip_trampoline_code): Update. * sol-thread.c (info_cb): Update. * stabsread.c (scan_file_globals): Update. * stack.c (find_frame_funname): Update. (info_frame_command_core): Update. * symmisc.c (dump_msymbols): Update. * symtab.c (symbol_natural_name): Rename to.., (general_symbol_info::natural_name): ...this. (symbol_demangled_name): Rename to... (general_symbol_info::demangled_name): ...this. (symbol_search_name): Rename to... (general_symbol_info::search_name): ...this. (symbol_matches_search_name): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (search_symbols): Update. (print_msymbol_info): Update. (rbreak_command): Update. (completion_list_add_msymbol): Update. (completion_list_objc_symbol): Update. (get_msymbol_address): Update. * symtab.h (struct general_symbol_info): Add member functions natural_name (), linkage_name (), print_name (), demangled_name (), and search_name (). (SYMBOL_NATURAL_NAME): Update. (symbol_natural_name): Move to a member function on general_symbol_info. (SYMBOL_DEMANGLED_NAME): Update. (symbol_demangled_name): Move to a member function on general_symbol_info. (SYMBOL_SEARCH_NAME): Update. (symbol_search_name): Move to a member function on general_symbol_info. (MSYMBOL_NATURAL_NAME): Remove. (MSYMBOL_LINKAGE_NAME): Remove. (MSYMBOL_PRINT_NAME): Remove. (MSYMBOL_DEMANGLED_NAME): Remove. (MSYMBOL_SEARCH_NAME): Remove. * x86-tdep.c (x86_in_indirect_branch_thunk): Update. Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee
2019-11-22 19:05:14 +01:00
const char *name = msym.minsym->linkage_name ();
/* The GNU linker's Thumb call stub to foo is named
__foo_from_thumb. */
if (strstr (name, "_from_thumb") != NULL)
name += 2;
/* On soft-float targets, __truncdfsf2 is called to convert promoted
arguments to their argument types in non-prototyped
functions. */
if (startswith (name, "__truncdfsf2"))
return 1;
if (startswith (name, "__aeabi_d2f"))
return 1;
/* Internal functions related to thread-local storage. */
if (startswith (name, "__tls_get_addr"))
return 1;
if (startswith (name, "__aeabi_read_tp"))
return 1;
}
else
{
/* If we run against a stripped glibc, we may be unable to identify
special functions by name. Check for one important case,
__aeabi_read_tp, by comparing the *code* against the default
implementation (this is hand-written ARM assembler in glibc). */
if (!is_thumb
&& read_code_unsigned_integer (pc, 4, byte_order_for_code)
== 0xe3e00a0f /* mov r0, #0xffff0fff */
&& read_code_unsigned_integer (pc + 4, 4, byte_order_for_code)
== 0xe240f01f) /* sub pc, r0, #31 */
return 1;
}
return 0;
}
/* Extract the immediate from instruction movw/movt of encoding T. INSN1 is
the first 16-bit of instruction, and INSN2 is the second 16-bit of
instruction. */
#define EXTRACT_MOVW_MOVT_IMM_T(insn1, insn2) \
((bits ((insn1), 0, 3) << 12) \
| (bits ((insn1), 10, 10) << 11) \
| (bits ((insn2), 12, 14) << 8) \
| bits ((insn2), 0, 7))
/* Extract the immediate from instruction movw/movt of encoding A. INSN is
the 32-bit instruction. */
#define EXTRACT_MOVW_MOVT_IMM_A(insn) \
((bits ((insn), 16, 19) << 12) \
| bits ((insn), 0, 11))
/* Decode immediate value; implements ThumbExpandImmediate pseudo-op. */
static unsigned int
thumb_expand_immediate (unsigned int imm)
{
unsigned int count = imm >> 7;
if (count < 8)
switch (count / 2)
{
case 0:
return imm & 0xff;
case 1:
return (imm & 0xff) | ((imm & 0xff) << 16);
case 2:
return ((imm & 0xff) << 8) | ((imm & 0xff) << 24);
case 3:
return (imm & 0xff) | ((imm & 0xff) << 8)
| ((imm & 0xff) << 16) | ((imm & 0xff) << 24);
}
return (0x80 | (imm & 0x7f)) << (32 - count);
}
/* Return 1 if the 16-bit Thumb instruction INSN restores SP in
epilogue, 0 otherwise. */
static int
thumb_instruction_restores_sp (unsigned short insn)
{
return (insn == 0x46bd /* mov sp, r7 */
|| (insn & 0xff80) == 0xb000 /* add sp, imm */
|| (insn & 0xfe00) == 0xbc00); /* pop <registers> */
}
/* Analyze a Thumb prologue, looking for a recognizable stack frame
and frame pointer. Scan until we encounter a store that could
clobber the stack frame unexpectedly, or an unknown instruction.
Return the last address which is definitely safe to skip for an
initial breakpoint. */
static CORE_ADDR
thumb_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR start, CORE_ADDR limit,
struct arm_prologue_cache *cache)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
* 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 19:25:59 +02:00
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int i;
pv_t regs[16];
CORE_ADDR offset;
CORE_ADDR unrecognized_pc = 0;
for (i = 0; i < 16; i++)
regs[i] = pv_register (i, 0);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
pv_area stack (ARM_SP_REGNUM, gdbarch_addr_bit (gdbarch));
while (start < limit)
{
unsigned short insn;
insn = read_code_unsigned_integer (start, 2, byte_order_for_code);
if ((insn & 0xfe00) == 0xb400) /* push { rlist } */
2000-02-01 04:19:29 +01:00
{
int regno;
int mask;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
/* Bits 0-7 contain a mask for registers R0-R7. Bit 8 says
whether to save LR (R14). */
mask = (insn & 0xff) | ((insn & 0x100) << 6);
/* Calculate offsets of saved R0-R7 and LR. */
for (regno = ARM_LR_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM],
-4);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (regs[ARM_SP_REGNUM], 4, regs[regno]);
}
2000-02-01 04:19:29 +01:00
}
else if ((insn & 0xff80) == 0xb080) /* sub sp, #imm */
2000-02-01 04:19:29 +01:00
{
offset = (insn & 0x7f) << 2; /* get scaled offset */
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM],
-offset);
2000-02-01 04:19:29 +01:00
}
Stop prologue analysis when past the epilogue We see a fail in gdb.trace/entry-values.exp on armv4t thumb, bt^M #0 0x000086fc in foo (i=0, i@entry=<optimized out>, j=2, j@entry=<optimized out>)^M #1 0x00000002 in ?? ()^M Backtrace stopped: previous frame identical to this frame (corrupt stack?)^M (gdb) FAIL: gdb.trace/entry-values.exp: bt (1) (pattern 1) The fail is caused by incorrect prologue analysis, which can be illustrated by setting a breakpoint on function foo, (gdb) disassemble foo Dump of assembler code for function foo: 0x000086e8 <+0>: push {r7, lr} 0x000086ea <+2>: sub sp, #8 0x000086ec <+4>: add r7, sp, #0 0x000086ee <+6>: str r0, [r7, #4] 0x000086f0 <+8>: str r1, [r7, #0] 0x000086f2 <+10>: movs r3, #0 0x000086f4 <+12>: adds r0, r3, #0 0x000086f6 <+14>: mov sp, r7 0x000086f8 <+16>: add sp, #8 0x000086fa <+18>: pop {r7} 0x000086fc <+20>: pop {r1} 0x000086fe <+22>: bx r1 End of assembler dump. (gdb) b foo Breakpoint 1 at 0x86fc As we can see, GDB analyzes the prologue and skip the prologue to the last instruction but one. The breakpoint is set within the epilogue, and GDB skips too many instruction for prologue. This patch teaches GDB to stop prologue analysis when goes into the epilogue. With this patch applied, GDB is able to unwind correctly, (gdb) bt #0 0x000086f6 in foo (i=0, i@entry=2, j=2, j@entry=3) #1 0x00008718 in bar (i=<optimized out>) #2 0x00008758 in main () gdb: 2014-07-11 Yao Qi <yao@codesourcery.com> * arm-tdep.c (thumb_analyze_prologue): Break the loop if thumb_instruction_restores_sp return true.
2014-07-02 09:16:26 +02:00
else if (thumb_instruction_restores_sp (insn))
{
/* Don't scan past the epilogue. */
break;
}
else if ((insn & 0xf800) == 0xa800) /* add Rd, sp, #imm */
regs[bits (insn, 8, 10)] = pv_add_constant (regs[ARM_SP_REGNUM],
(insn & 0xff) << 2);
else if ((insn & 0xfe00) == 0x1c00 /* add Rd, Rn, #imm */
&& pv_is_register (regs[bits (insn, 3, 5)], ARM_SP_REGNUM))
regs[bits (insn, 0, 2)] = pv_add_constant (regs[bits (insn, 3, 5)],
bits (insn, 6, 8));
else if ((insn & 0xf800) == 0x3000 /* add Rd, #imm */
&& pv_is_register (regs[bits (insn, 8, 10)], ARM_SP_REGNUM))
regs[bits (insn, 8, 10)] = pv_add_constant (regs[bits (insn, 8, 10)],
bits (insn, 0, 7));
else if ((insn & 0xfe00) == 0x1800 /* add Rd, Rn, Rm */
&& pv_is_register (regs[bits (insn, 6, 8)], ARM_SP_REGNUM)
&& pv_is_constant (regs[bits (insn, 3, 5)]))
regs[bits (insn, 0, 2)] = pv_add (regs[bits (insn, 3, 5)],
regs[bits (insn, 6, 8)]);
else if ((insn & 0xff00) == 0x4400 /* add Rd, Rm */
&& pv_is_constant (regs[bits (insn, 3, 6)]))
{
int rd = (bit (insn, 7) << 3) + bits (insn, 0, 2);
int rm = bits (insn, 3, 6);
regs[rd] = pv_add (regs[rd], regs[rm]);
}
else if ((insn & 0xff00) == 0x4600) /* mov hi, lo or mov lo, hi */
2000-02-01 04:19:29 +01:00
{
int dst_reg = (insn & 0x7) + ((insn & 0x80) >> 4);
int src_reg = (insn & 0x78) >> 3;
regs[dst_reg] = regs[src_reg];
2000-02-01 04:19:29 +01:00
}
else if ((insn & 0xf800) == 0x9000) /* str rd, [sp, #off] */
2000-02-01 04:19:29 +01:00
{
/* Handle stores to the stack. Normally pushes are used,
but with GCC -mtpcs-frame, there may be other stores
in the prologue to create the frame. */
int regno = (insn >> 8) & 0x7;
pv_t addr;
offset = (insn & 0xff) << 2;
addr = pv_add_constant (regs[ARM_SP_REGNUM], offset);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (addr))
break;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (addr, 4, regs[regno]);
2000-02-01 04:19:29 +01:00
}
else if ((insn & 0xf800) == 0x6000) /* str rd, [rn, #off] */
{
int rd = bits (insn, 0, 2);
int rn = bits (insn, 3, 5);
pv_t addr;
offset = bits (insn, 6, 10) << 2;
addr = pv_add_constant (regs[rn], offset);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (addr))
break;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (addr, 4, regs[rd]);
}
else if (((insn & 0xf800) == 0x7000 /* strb Rd, [Rn, #off] */
|| (insn & 0xf800) == 0x8000) /* strh Rd, [Rn, #off] */
&& pv_is_register (regs[bits (insn, 3, 5)], ARM_SP_REGNUM))
/* Ignore stores of argument registers to the stack. */
;
else if ((insn & 0xf800) == 0xc800 /* ldmia Rn!, { registers } */
&& pv_is_register (regs[bits (insn, 8, 10)], ARM_SP_REGNUM))
/* Ignore block loads from the stack, potentially copying
parameters from memory. */
;
else if ((insn & 0xf800) == 0x9800 /* ldr Rd, [Rn, #immed] */
|| ((insn & 0xf800) == 0x6800 /* ldr Rd, [sp, #immed] */
&& pv_is_register (regs[bits (insn, 3, 5)], ARM_SP_REGNUM)))
/* Similarly ignore single loads from the stack. */
;
else if ((insn & 0xffc0) == 0x0000 /* lsls Rd, Rm, #0 */
|| (insn & 0xffc0) == 0x1c00) /* add Rd, Rn, #0 */
/* Skip register copies, i.e. saves to another register
instead of the stack. */
;
else if ((insn & 0xf800) == 0x2000) /* movs Rd, #imm */
/* Recognize constant loads; even with small stacks these are necessary
on Thumb. */
regs[bits (insn, 8, 10)] = pv_constant (bits (insn, 0, 7));
else if ((insn & 0xf800) == 0x4800) /* ldr Rd, [pc, #imm] */
{
/* Constant pool loads, for the same reason. */
unsigned int constant;
CORE_ADDR loc;
loc = start + 4 + bits (insn, 0, 7) * 4;
constant = read_memory_unsigned_integer (loc, 4, byte_order);
regs[bits (insn, 8, 10)] = pv_constant (constant);
}
else if (thumb_insn_size (insn) == 4) /* 32-bit Thumb-2 instructions. */
{
unsigned short inst2;
inst2 = read_code_unsigned_integer (start + 2, 2,
byte_order_for_code);
if ((insn & 0xf800) == 0xf000 && (inst2 & 0xe800) == 0xe800)
{
/* BL, BLX. Allow some special function calls when
skipping the prologue; GCC generates these before
storing arguments to the stack. */
CORE_ADDR nextpc;
int j1, j2, imm1, imm2;
imm1 = sbits (insn, 0, 10);
imm2 = bits (inst2, 0, 10);
j1 = bit (inst2, 13);
j2 = bit (inst2, 11);
offset = ((imm1 << 12) + (imm2 << 1));
offset ^= ((!j2) << 22) | ((!j1) << 23);
nextpc = start + 4 + offset;
/* For BLX make sure to clear the low bits. */
if (bit (inst2, 12) == 0)
nextpc = nextpc & 0xfffffffc;
if (!skip_prologue_function (gdbarch, nextpc,
bit (inst2, 12) != 0))
break;
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
else if ((insn & 0xffd0) == 0xe900 /* stmdb Rn{!},
{ registers } */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
pv_t addr = regs[bits (insn, 0, 3)];
int regno;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (addr))
break;
/* Calculate offsets of saved registers. */
for (regno = ARM_LR_REGNUM; regno >= 0; regno--)
if (inst2 & (1 << regno))
{
addr = pv_add_constant (addr, -4);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (addr, 4, regs[regno]);
}
if (insn & 0x0020)
regs[bits (insn, 0, 3)] = addr;
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
else if ((insn & 0xff50) == 0xe940 /* strd Rt, Rt2,
[Rn, #+/-imm]{!} */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
int regno1 = bits (inst2, 12, 15);
int regno2 = bits (inst2, 8, 11);
pv_t addr = regs[bits (insn, 0, 3)];
offset = inst2 & 0xff;
if (insn & 0x0080)
addr = pv_add_constant (addr, offset);
else
addr = pv_add_constant (addr, -offset);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (addr))
break;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (addr, 4, regs[regno1]);
stack.store (pv_add_constant (addr, 4),
4, regs[regno2]);
if (insn & 0x0020)
regs[bits (insn, 0, 3)] = addr;
}
else if ((insn & 0xfff0) == 0xf8c0 /* str Rt,[Rn,+/-#imm]{!} */
&& (inst2 & 0x0c00) == 0x0c00
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
int regno = bits (inst2, 12, 15);
pv_t addr = regs[bits (insn, 0, 3)];
offset = inst2 & 0xff;
if (inst2 & 0x0200)
addr = pv_add_constant (addr, offset);
else
addr = pv_add_constant (addr, -offset);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (addr))
break;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (addr, 4, regs[regno]);
if (inst2 & 0x0100)
regs[bits (insn, 0, 3)] = addr;
}
else if ((insn & 0xfff0) == 0xf8c0 /* str.w Rt,[Rn,#imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
{
int regno = bits (inst2, 12, 15);
pv_t addr;
offset = inst2 & 0xfff;
addr = pv_add_constant (regs[bits (insn, 0, 3)], offset);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (addr))
break;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (addr, 4, regs[regno]);
}
else if ((insn & 0xffd0) == 0xf880 /* str{bh}.w Rt,[Rn,#imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Ignore stores of argument registers to the stack. */
;
else if ((insn & 0xffd0) == 0xf800 /* str{bh} Rt,[Rn,#+/-imm] */
&& (inst2 & 0x0d00) == 0x0c00
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Ignore stores of argument registers to the stack. */
;
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
else if ((insn & 0xffd0) == 0xe890 /* ldmia Rn[!],
{ registers } */
&& (inst2 & 0x8000) == 0x0000
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Ignore block loads from the stack, potentially copying
parameters from memory. */
;
else if ((insn & 0xff70) == 0xe950 /* ldrd Rt, Rt2,
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
[Rn, #+/-imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Similarly ignore dual loads from the stack. */
;
else if ((insn & 0xfff0) == 0xf850 /* ldr Rt,[Rn,#+/-imm] */
&& (inst2 & 0x0d00) == 0x0c00
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Similarly ignore single loads from the stack. */
;
else if ((insn & 0xfff0) == 0xf8d0 /* ldr.w Rt,[Rn,#imm] */
&& pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM))
/* Similarly ignore single loads from the stack. */
;
else if ((insn & 0xfbf0) == 0xf100 /* add.w Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
unsigned int imm = ((bits (insn, 10, 10) << 11)
| (bits (inst2, 12, 14) << 8)
| bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_add_constant (regs[bits (insn, 0, 3)],
thumb_expand_immediate (imm));
}
else if ((insn & 0xfbf0) == 0xf200 /* addw Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
unsigned int imm = ((bits (insn, 10, 10) << 11)
| (bits (inst2, 12, 14) << 8)
| bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_add_constant (regs[bits (insn, 0, 3)], imm);
}
else if ((insn & 0xfbf0) == 0xf1a0 /* sub.w Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
unsigned int imm = ((bits (insn, 10, 10) << 11)
| (bits (inst2, 12, 14) << 8)
| bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_add_constant (regs[bits (insn, 0, 3)],
- (CORE_ADDR) thumb_expand_immediate (imm));
}
else if ((insn & 0xfbf0) == 0xf2a0 /* subw Rd, Rn, #imm */
&& (inst2 & 0x8000) == 0x0000)
{
unsigned int imm = ((bits (insn, 10, 10) << 11)
| (bits (inst2, 12, 14) << 8)
| bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_add_constant (regs[bits (insn, 0, 3)], - (CORE_ADDR) imm);
}
else if ((insn & 0xfbff) == 0xf04f) /* mov.w Rd, #const */
{
unsigned int imm = ((bits (insn, 10, 10) << 11)
| (bits (inst2, 12, 14) << 8)
| bits (inst2, 0, 7));
regs[bits (inst2, 8, 11)]
= pv_constant (thumb_expand_immediate (imm));
}
else if ((insn & 0xfbf0) == 0xf240) /* movw Rd, #const */
{
unsigned int imm
= EXTRACT_MOVW_MOVT_IMM_T (insn, inst2);
regs[bits (inst2, 8, 11)] = pv_constant (imm);
}
else if (insn == 0xea5f /* mov.w Rd,Rm */
&& (inst2 & 0xf0f0) == 0)
{
int dst_reg = (inst2 & 0x0f00) >> 8;
int src_reg = inst2 & 0xf;
regs[dst_reg] = regs[src_reg];
}
else if ((insn & 0xff7f) == 0xf85f) /* ldr.w Rt,<label> */
{
/* Constant pool loads. */
unsigned int constant;
CORE_ADDR loc;
offset = bits (inst2, 0, 11);
if (insn & 0x0080)
loc = start + 4 + offset;
else
loc = start + 4 - offset;
constant = read_memory_unsigned_integer (loc, 4, byte_order);
regs[bits (inst2, 12, 15)] = pv_constant (constant);
}
else if ((insn & 0xff7f) == 0xe95f) /* ldrd Rt,Rt2,<label> */
{
/* Constant pool loads. */
unsigned int constant;
CORE_ADDR loc;
offset = bits (inst2, 0, 7) << 2;
if (insn & 0x0080)
loc = start + 4 + offset;
else
loc = start + 4 - offset;
constant = read_memory_unsigned_integer (loc, 4, byte_order);
regs[bits (inst2, 12, 15)] = pv_constant (constant);
constant = read_memory_unsigned_integer (loc + 4, 4, byte_order);
regs[bits (inst2, 8, 11)] = pv_constant (constant);
}
else if (thumb2_instruction_changes_pc (insn, inst2))
{
/* Don't scan past anything that might change control flow. */
break;
}
else
{
/* The optimizer might shove anything into the prologue,
so we just skip what we don't recognize. */
unrecognized_pc = start;
}
start += 2;
}
else if (thumb_instruction_changes_pc (insn))
{
/* Don't scan past anything that might change control flow. */
break;
}
else
{
/* The optimizer might shove anything into the prologue,
so we just skip what we don't recognize. */
unrecognized_pc = start;
}
start += 2;
}
if (arm_debug)
fprintf_unfiltered (gdb_stdlog, "Prologue scan stopped at %s\n",
paddress (gdbarch, start));
if (unrecognized_pc == 0)
unrecognized_pc = start;
if (cache == NULL)
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
return unrecognized_pc;
if (pv_is_register (regs[ARM_FP_REGNUM], ARM_SP_REGNUM))
{
/* Frame pointer is fp. Frame size is constant. */
cache->framereg = ARM_FP_REGNUM;
cache->framesize = -regs[ARM_FP_REGNUM].k;
}
else if (pv_is_register (regs[THUMB_FP_REGNUM], ARM_SP_REGNUM))
{
/* Frame pointer is r7. Frame size is constant. */
cache->framereg = THUMB_FP_REGNUM;
cache->framesize = -regs[THUMB_FP_REGNUM].k;
}
else
{
/* Try the stack pointer... this is a bit desperate. */
cache->framereg = ARM_SP_REGNUM;
cache->framesize = -regs[ARM_SP_REGNUM].k;
}
for (i = 0; i < 16; i++)
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.find_reg (gdbarch, i, &offset))
cache->saved_regs[i].addr = offset;
return unrecognized_pc;
}
/* Try to analyze the instructions starting from PC, which load symbol
__stack_chk_guard. Return the address of instruction after loading this
symbol, set the dest register number to *BASEREG, and set the size of
instructions for loading symbol in OFFSET. Return 0 if instructions are
not recognized. */
static CORE_ADDR
arm_analyze_load_stack_chk_guard(CORE_ADDR pc, struct gdbarch *gdbarch,
unsigned int *destreg, int *offset)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int is_thumb = arm_pc_is_thumb (gdbarch, pc);
unsigned int low, high, address;
address = 0;
if (is_thumb)
{
unsigned short insn1
= read_code_unsigned_integer (pc, 2, byte_order_for_code);
if ((insn1 & 0xf800) == 0x4800) /* ldr Rd, #immed */
{
*destreg = bits (insn1, 8, 10);
*offset = 2;
Fix skipping stack protector on arm This patch fixes the bug in my patch skipping stack protector https://www.sourceware.org/ml/gdb-patches/2010-12/msg00110.html In my skipping stack protector patch, I misunderstood the constant vs. immediate on instruction encodings, and treated immediate as constant by mistake. The instruction 'ldr Rd, [PC, #immed]' loads the address of __stack_chk_guard to Rd, and #immed is an offset from PC. We should get the __stack_chk_guard from *(pc + #immed). As a result of this mistake, arm_analyze_load_stack_chk_guard returns the wrong address of __stack_chk_guard, and the symbol __stack_chk_guard can't be found. However, we continue to match the following instructions when symbol isn't found, so the code still works. In other words, the code just matches the instruction pattern without checking __stack_chk_guard symbol correctly. Joel's patch <https://sourceware.org/ml/gdb-patches/2014-10/msg00605.html> makes the heuristics stricter that we stop matching instructions if symbol __stack_chk_guard isn't found. Then the bug is exposed. This patch is to correct the load address computation for ldr instruction, and it fixes some fails in gdb.mi/gdb792.exp on armv4t both arm and thumb mode. Regression tested on arm-linux-gnueabi target with {armv4t, armv7-a} x {marm, mthumb} x {-fstack-protector,-fno-stack-protector} gdb: 2014-10-29 Yao Qi <yao@codesourcery.com> * arm-tdep.c (arm_analyze_load_stack_chk_guard): Compute the loaded address correctly of ldr instruction.
2014-10-29 06:39:16 +01:00
address = (pc & 0xfffffffc) + 4 + (bits (insn1, 0, 7) << 2);
address = read_memory_unsigned_integer (address, 4,
byte_order_for_code);
}
else if ((insn1 & 0xfbf0) == 0xf240) /* movw Rd, #const */
{
unsigned short insn2
= read_code_unsigned_integer (pc + 2, 2, byte_order_for_code);
low = EXTRACT_MOVW_MOVT_IMM_T (insn1, insn2);
insn1
= read_code_unsigned_integer (pc + 4, 2, byte_order_for_code);
insn2
= read_code_unsigned_integer (pc + 6, 2, byte_order_for_code);
/* movt Rd, #const */
if ((insn1 & 0xfbc0) == 0xf2c0)
{
high = EXTRACT_MOVW_MOVT_IMM_T (insn1, insn2);
*destreg = bits (insn2, 8, 11);
*offset = 8;
address = (high << 16 | low);
}
}
}
else
{
unsigned int insn
= read_code_unsigned_integer (pc, 4, byte_order_for_code);
Fix skipping stack protector on arm This patch fixes the bug in my patch skipping stack protector https://www.sourceware.org/ml/gdb-patches/2010-12/msg00110.html In my skipping stack protector patch, I misunderstood the constant vs. immediate on instruction encodings, and treated immediate as constant by mistake. The instruction 'ldr Rd, [PC, #immed]' loads the address of __stack_chk_guard to Rd, and #immed is an offset from PC. We should get the __stack_chk_guard from *(pc + #immed). As a result of this mistake, arm_analyze_load_stack_chk_guard returns the wrong address of __stack_chk_guard, and the symbol __stack_chk_guard can't be found. However, we continue to match the following instructions when symbol isn't found, so the code still works. In other words, the code just matches the instruction pattern without checking __stack_chk_guard symbol correctly. Joel's patch <https://sourceware.org/ml/gdb-patches/2014-10/msg00605.html> makes the heuristics stricter that we stop matching instructions if symbol __stack_chk_guard isn't found. Then the bug is exposed. This patch is to correct the load address computation for ldr instruction, and it fixes some fails in gdb.mi/gdb792.exp on armv4t both arm and thumb mode. Regression tested on arm-linux-gnueabi target with {armv4t, armv7-a} x {marm, mthumb} x {-fstack-protector,-fno-stack-protector} gdb: 2014-10-29 Yao Qi <yao@codesourcery.com> * arm-tdep.c (arm_analyze_load_stack_chk_guard): Compute the loaded address correctly of ldr instruction.
2014-10-29 06:39:16 +01:00
if ((insn & 0x0e5f0000) == 0x041f0000) /* ldr Rd, [PC, #immed] */
{
Fix skipping stack protector on arm This patch fixes the bug in my patch skipping stack protector https://www.sourceware.org/ml/gdb-patches/2010-12/msg00110.html In my skipping stack protector patch, I misunderstood the constant vs. immediate on instruction encodings, and treated immediate as constant by mistake. The instruction 'ldr Rd, [PC, #immed]' loads the address of __stack_chk_guard to Rd, and #immed is an offset from PC. We should get the __stack_chk_guard from *(pc + #immed). As a result of this mistake, arm_analyze_load_stack_chk_guard returns the wrong address of __stack_chk_guard, and the symbol __stack_chk_guard can't be found. However, we continue to match the following instructions when symbol isn't found, so the code still works. In other words, the code just matches the instruction pattern without checking __stack_chk_guard symbol correctly. Joel's patch <https://sourceware.org/ml/gdb-patches/2014-10/msg00605.html> makes the heuristics stricter that we stop matching instructions if symbol __stack_chk_guard isn't found. Then the bug is exposed. This patch is to correct the load address computation for ldr instruction, and it fixes some fails in gdb.mi/gdb792.exp on armv4t both arm and thumb mode. Regression tested on arm-linux-gnueabi target with {armv4t, armv7-a} x {marm, mthumb} x {-fstack-protector,-fno-stack-protector} gdb: 2014-10-29 Yao Qi <yao@codesourcery.com> * arm-tdep.c (arm_analyze_load_stack_chk_guard): Compute the loaded address correctly of ldr instruction.
2014-10-29 06:39:16 +01:00
address = bits (insn, 0, 11) + pc + 8;
address = read_memory_unsigned_integer (address, 4,
byte_order_for_code);
*destreg = bits (insn, 12, 15);
*offset = 4;
}
else if ((insn & 0x0ff00000) == 0x03000000) /* movw Rd, #const */
{
low = EXTRACT_MOVW_MOVT_IMM_A (insn);
insn
= read_code_unsigned_integer (pc + 4, 4, byte_order_for_code);
if ((insn & 0x0ff00000) == 0x03400000) /* movt Rd, #const */
{
high = EXTRACT_MOVW_MOVT_IMM_A (insn);
*destreg = bits (insn, 12, 15);
*offset = 8;
address = (high << 16 | low);
}
}
}
return address;
}
/* Try to skip a sequence of instructions used for stack protector. If PC
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
points to the first instruction of this sequence, return the address of
first instruction after this sequence, otherwise, return original PC.
On arm, this sequence of instructions is composed of mainly three steps,
Step 1: load symbol __stack_chk_guard,
Step 2: load from address of __stack_chk_guard,
Step 3: store it to somewhere else.
Usually, instructions on step 2 and step 3 are the same on various ARM
architectures. On step 2, it is one instruction 'ldr Rx, [Rn, #0]', and
on step 3, it is also one instruction 'str Rx, [r7, #immd]'. However,
instructions in step 1 vary from different ARM architectures. On ARMv7,
they are,
movw Rn, #:lower16:__stack_chk_guard
movt Rn, #:upper16:__stack_chk_guard
On ARMv5t, it is,
ldr Rn, .Label
....
.Lable:
.word __stack_chk_guard
Since ldr/str is a very popular instruction, we can't use them as
'fingerprint' or 'signature' of stack protector sequence. Here we choose
sequence {movw/movt, ldr}/ldr/str plus symbol __stack_chk_guard, if not
stripped, as the 'fingerprint' of a stack protector cdoe sequence. */
static CORE_ADDR
arm_skip_stack_protector(CORE_ADDR pc, struct gdbarch *gdbarch)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
2012-05-18 Sergio Durigan Junior <sergiodj@redhat.com> * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: * avr-tdep.c: * ax-gdb.c: * bfin-linux-tdep.c: * breakpoint.c: * c-valprint.c: * cli/cli-cmds.c: * coffread.c: * cp-support.c: * cris-tdep.c: * dwarf2-frame-tailcall.c: * dwarf2-frame.c: * dwarf2expr.c: * dwarf2loc.c: * dwarf2read.c: * elfread.c: * eval.c: * expprint.c: * f-valprint.c: * frv-tdep.c: * h8300-tdep.c: * hppa-hpux-tdep.c: * hppa-tdep.c: * hppanbsd-tdep.c: * i386-nto-tdep.c: * i386-tdep.c: * i387-tdep.c: * ia64-tdep.c: * jit.c: * linespec.c: * linux-tdep.c: * lm32-tdep.c: * m2-valprint.c: * m32c-tdep.c: * m32r-rom.c: * m32r-tdep.c: * m68k-tdep.c: * m68klinux-tdep.c: * mi/mi-main.c: * microblaze-tdep.c: * mips-linux-tdep.c: * mips-tdep.c: * mn10300-tdep.c: * p-valprint.c: * parse.c: * ppc-linux-tdep.c: * ppc-sysv-tdep.c: * printcmd.c: * python/py-finishbreakpoint.c: * python/py-inferior.c: * python/py-infthread.c: * python/py-type.c: * python/python.c: * remote-fileio.c: * remote-m32r-sdi.c: * remote-mips.c: * reverse.c: * rl78-tdep.c: * rs6000-aix-tdep.c: * rs6000-tdep.c: * s390-tdep.c: * score-tdep.c: * sh64-tdep.c: * skip.c: * solib-darwin.c: * solib-dsbt.c: * solib-frv.c: * sparc-tdep.c: * spu-multiarch.c: * spu-tdep.c: * stack.c: * symfile.c: * symtab.c: * tic6x-tdep.c: * tracepoint.c: * v850-tdep.c: * valarith.c: * valprint.c: * value.c: * xcoffread.c: * xtensa-tdep.c: * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: Delete unused variables.
2012-05-18 23:02:52 +02:00
unsigned int basereg;
struct bound_minimal_symbol stack_chk_guard;
int offset;
int is_thumb = arm_pc_is_thumb (gdbarch, pc);
CORE_ADDR addr;
/* Try to parse the instructions in Step 1. */
addr = arm_analyze_load_stack_chk_guard (pc, gdbarch,
&basereg, &offset);
if (!addr)
return pc;
stack_chk_guard = lookup_minimal_symbol_by_pc (addr);
ARM: stricter __stack_chk_guard check during prologue analysis We are trying to insert a breakpoint on line 4 for the following Ada code. 3 procedure STR is 4 XX : String (1 .. Blocks.Sz) := (others => 'X'); -- STOP 5 K : Integer; 6 begin 7 K := 13; The code generated on ARM (-march=armv7-m) starts like this: (gdb) disass str'address Dump of assembler code for function _ada_str: --# Line str.adb:3 0x08000014 <+0>: push {r4, r7, lr} 0x08000016 <+2>: sub sp, #28 0x08000018 <+4>: add r7, sp, #0 0x0800001a <+6>: mov r3, sp 0x0800001c <+8>: mov r4, r3 --# Line str.adb:4 0x0800001e <+10>: ldr r3, [pc, #84] ; (0x8000074 <_ada_str+96>) 0x08000020 <+12>: ldr r3, [r3, #0] 0x08000022 <+14>: str r3, [r7, #20] 0x08000024 <+16>: ldr r3, [r7, #20] [...] When computing the address related to str.adb:4, GDB correctly resolves it to 0x0800001e first, but then considers the next 3 instructions as being part of the prologue because it thinks they are part of stack-protector code. As a result, instead of inserting the breakpoint at line 4, it skips those instruction and consequently the rest of the instructions until the start of the next line, which his line 7. The stack-protector code is expected to start like this... ldr Rn, .Label .... .Lable: .word __stack_chk_guard ... but the implementation actually accepts a sequence where the ldr location points to an address for which there is no symbol. It only aborts if the address points to a symbol which is not __stack_chk_guard. Since the __stack_chk_guard symbol is always expected to exist when used (it lives in .dynsym), this patch fixes the issue by requiring that the ldr gets the address of the __stack_chk_guard symbol. If the address could not be resolved, then it rejects the sequence as being stack-protector code. gdb/ChangeLog: * arm-tdep.c (arm_skip_stack_protector): Return early if address loaded by first "ldr" instruction does not have a corresponding minimal symbol. Update comment. Tested on arm-eabi using AdaCore's testsuite. Tested on arm-linux-gnueabi by Yao as well.
2014-10-23 17:25:20 +02:00
/* ADDR must correspond to a symbol whose name is __stack_chk_guard.
Otherwise, this sequence cannot be for stack protector. */
if (stack_chk_guard.minsym == NULL
Replace the MSYMBOL_*_NAME macros with member functions Improves readability. In the future, it will also allow making the name private, once the name setter functions become member functions. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_lookup_simple_minsym): Update. (ada_collect_symbol_completion_matches): Update. * ada-tasks.c (read_atcb): Update. * amd64-windows-tdep.c (amd64_skip_main_prologue): Update. (amd64_windows_skip_trampoline_code): Update. * arm-tdep.c (skip_prologue_function): Update. (arm_skip_stack_protector): Update. * arm-wince-tdep.c (arm_pe_skip_trampoline_code): Update. (arm_wince_skip_main_prologue): Update. * ax-gdb.c (gen_expr): Update. * block.c (call_site_for_pc): Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (set_breakpoint_location_function): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * c-valprint.c (print_unpacked_pointer): Update. * coffread.c (coff_symfile_read): Update. * compile/compile-c-symbols.c (convert_symbol_bmsym): Update. * compile/compile-cplus-symbols.c (convert_symbol_bmsym): Update. * dwarf-index-write.c (write_psymbols): Update. * dwarf2loc.c (call_site_to_target_addr): Update. (func_verify_no_selftailcall): Update. (tailcall_dump): Update. (call_site_find_chain_1): Update. (dwarf_expr_reg_to_entry_parameter): Update. * elfread.c (elf_gnu_ifunc_record_cache): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. (evaluate_subexp_for_sizeof): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * frame.c (get_prev_frame_always_1): Update. * frv-tdep.c (frv_skip_main_prologue): Update. * gnu-v2-abi.c (gnuv2_value_rtti_type): Update. * gnu-v3-abi.c (gnuv3_rtti_type): Update. (gnuv3_get_typename_from_type_info): Update. (gnuv3_skip_trampoline): Update. * hppa-tdep.c (hppa_lookup_stub_minimal_symbol): Update. * i386-tdep.c (i386_skip_main_prologue): Update. (i386_pe_skip_trampoline_code): Update. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Update. * infcall.c (get_function_name): Update. * linespec.c (minsym_found): Update. * linux-fork.c (info_checkpoints_command): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. (m32c_m16c_pointer_to_address): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (add_minsym_to_hash_table): Update. (add_minsym_to_demangled_hash_table): Update. (lookup_minimal_symbol_mangled): Update. (lookup_minimal_symbol_demangled): Update. (lookup_minimal_symbol_linkage): Update. (lookup_minimal_symbol_text): Update. (lookup_minimal_symbol_by_pc_name): Update. (minimal_symbol_is_less_than): Update. (compact_minimal_symbols): Update. (build_minimal_symbol_hash_tables): Update. (find_solib_trampoline_target): Update. * mips-tdep.c (mips_stub_frame_sniffer): Update. (mips_skip_pic_trampoline_code): Update. * msp430-tdep.c (msp430_skip_trampoline_code): Update. * objc-lang.c (info_selectors_command): Update. (info_classes_command): Update. (find_methods): Update. (find_imps): Update. * p-valprint.c (pascal_val_print): Update. * ppc-linux-tdep.c (powerpc_linux_in_dynsym_resolve_code): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic): Update. (info_symbol_command): Update. * psymtab.c (psymbol_name_matches): Update. (match_partial_symbol): Update. (lookup_partial_symbol): Update. (print_partial_symbols): Update. (sort_pst_symbols): Update. (maintenance_check_psymtabs): Update. * python/py-framefilter.c (py_print_frame): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rs6000-tdep.c (rs6000_skip_main_prologue): Update. (rs6000_skip_trampoline_code): Update. * sol-thread.c (info_cb): Update. * stabsread.c (scan_file_globals): Update. * stack.c (find_frame_funname): Update. (info_frame_command_core): Update. * symmisc.c (dump_msymbols): Update. * symtab.c (symbol_natural_name): Rename to.., (general_symbol_info::natural_name): ...this. (symbol_demangled_name): Rename to... (general_symbol_info::demangled_name): ...this. (symbol_search_name): Rename to... (general_symbol_info::search_name): ...this. (symbol_matches_search_name): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (search_symbols): Update. (print_msymbol_info): Update. (rbreak_command): Update. (completion_list_add_msymbol): Update. (completion_list_objc_symbol): Update. (get_msymbol_address): Update. * symtab.h (struct general_symbol_info): Add member functions natural_name (), linkage_name (), print_name (), demangled_name (), and search_name (). (SYMBOL_NATURAL_NAME): Update. (symbol_natural_name): Move to a member function on general_symbol_info. (SYMBOL_DEMANGLED_NAME): Update. (symbol_demangled_name): Move to a member function on general_symbol_info. (SYMBOL_SEARCH_NAME): Update. (symbol_search_name): Move to a member function on general_symbol_info. (MSYMBOL_NATURAL_NAME): Remove. (MSYMBOL_LINKAGE_NAME): Remove. (MSYMBOL_PRINT_NAME): Remove. (MSYMBOL_DEMANGLED_NAME): Remove. (MSYMBOL_SEARCH_NAME): Remove. * x86-tdep.c (x86_in_indirect_branch_thunk): Update. Change-Id: I65aa529843a9903e174ce799037e41f954a9fcee
2019-11-22 19:05:14 +01:00
|| !startswith (stack_chk_guard.minsym->linkage_name (), "__stack_chk_guard"))
return pc;
if (is_thumb)
{
unsigned int destreg;
unsigned short insn
= read_code_unsigned_integer (pc + offset, 2, byte_order_for_code);
/* Step 2: ldr Rd, [Rn, #immed], encoding T1. */
if ((insn & 0xf800) != 0x6800)
return pc;
if (bits (insn, 3, 5) != basereg)
return pc;
destreg = bits (insn, 0, 2);
insn = read_code_unsigned_integer (pc + offset + 2, 2,
byte_order_for_code);
/* Step 3: str Rd, [Rn, #immed], encoding T1. */
if ((insn & 0xf800) != 0x6000)
return pc;
if (destreg != bits (insn, 0, 2))
return pc;
}
else
{
unsigned int destreg;
unsigned int insn
= read_code_unsigned_integer (pc + offset, 4, byte_order_for_code);
/* Step 2: ldr Rd, [Rn, #immed], encoding A1. */
if ((insn & 0x0e500000) != 0x04100000)
return pc;
if (bits (insn, 16, 19) != basereg)
return pc;
destreg = bits (insn, 12, 15);
/* Step 3: str Rd, [Rn, #immed], encoding A1. */
insn = read_code_unsigned_integer (pc + offset + 4,
4, byte_order_for_code);
if ((insn & 0x0e500000) != 0x04000000)
return pc;
if (bits (insn, 12, 15) != destreg)
return pc;
}
/* The size of total two instructions ldr/str is 4 on Thumb-2, while 8
on arm. */
if (is_thumb)
return pc + offset + 4;
else
return pc + offset + 8;
}
/* Advance the PC across any function entry prologue instructions to
reach some "real" code.
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
The APCS (ARM Procedure Call Standard) defines the following
1999-12-22 22:45:38 +01:00
prologue:
1999-07-07 22:19:36 +02:00
mov ip, sp
[stmfd sp!, {a1,a2,a3,a4}]
stmfd sp!, {...,fp,ip,lr,pc}
1999-12-22 22:45:38 +01:00
[stfe f7, [sp, #-12]!]
[stfe f6, [sp, #-12]!]
[stfe f5, [sp, #-12]!]
[stfe f4, [sp, #-12]!]
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
sub fp, ip, #nn @@ nn == 20 or 4 depending on second insn. */
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
static CORE_ADDR
* gdbarch.sh (skip_prologue): Add gdbarch as parameter. * gdbarch.{c,h}: Regenerate. * alpha-tdep.c (alpha_skip_prologue): Add gdbarch as parameter. * amd64-tdep.c (amd64_skip_prologue): Likewise. * avr-tdep.c (avr_skip_prologue): Likewise. * cris-tdep.c (cris_skip_prologue): Likewise. * frv-tdep.c (frv_skip_prologue): Likewise. * h8300-tdep.c (h8300_skip_prologue): Likewise. * hppa-tdep.c (hppa_skip_prologue): Likewise. * i386-tdep.c (i386_skip_prologue): Likewise. * ia64-tdep.c (ia64_skip_prologue): Likewise. * iq2000-tdep.c (iq2000_skip_prologue): Likewise. * m32r-tdep.c (m32r_skip_prologue): Likewise. * m68hc11-tdep.c (m68hc11_skip_prologue): Likewise. * m68k-tdep.c (m68k_skip_prologue): Likewise. * m88k-tdep.c (m88k_skip_prologue): Likewise. * mep-tdep.c (mep_skip_prologue): Likewise. * mips-tdep.c (mips_skip_prologue): Likewise. * mn10300-tdep.c (mn10300_skip_prologue): Likewise. * mt-tdep.c (mt_skip_prologue): Likewise. * rs6000-tdep.c (rs6000_skip_prologue): Likewise. * score-tdep.c (score_skip_prologue): Likewise. * sh64-tdep.c (sh64_skip_prologue): Likewise. * sh-tdep.c (sh_skip_prologue): Likewise. * sparc64-tdep.c (sparc64_skip_prologue): Likewise. * sparc-tdep.c (sparc32_skip_prologue): Likewise. * spu-tdep.c (spu_skip_prologue): Likewise. * v850-tdep.c (v850_skip_prologue): Likewise. * vax-tdep.c (vax_skip_prologue): Likewise. * xstormy16-tdep.c (xstormy16_skip_prologue): Likewise. * xtensa-tdep.c (xtensa_skip_prologue): Likewise. * arm-tdep.c (arm_skip_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_prologue): Likewise. * s390-tdep.c (s390_skip_prologue): Likewise.
2008-01-11 14:20:02 +01:00
arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
CORE_ADDR func_addr, limit_pc;
/* See if we can determine the end of the prologue via the symbol table.
If so, then return either PC, or the PC after the prologue, whichever
is greater. */
if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
{
* dummy-frame.c (deprecated_pc_in_call_dummy): Add GDBARCH parameter, use it instead of current_gdbarch. * frame.h (deprecated_pc_in_call_dummy): Add GDBARCH parameter. * arm-tdep.c (arm_skip_prologue): Pass architecture to deprecated_pc_in_call_dummy. * symtab.c (skip_prologue_using_sal): Add GDBARCH parameter. Use it instead of current_gdbarch. * symtab.h (skip_prologue_using_sal): Add GDBARCH parameter. * breakpoint.c (expand_line_sal_maybe): Pass architecture to skip_prologue_using_sal. * arm-tdep.c (skip_prologue_using_sal): Likewise. * lm32-tdep.c (lm32_skip_prologue): Likewise. * m32-tdep.c (m32c_skip_prologue): Likewise. * mips-tdep.c (mips_skip_prologue): Likewise. * moxie-tdep.c (moxie_skip_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * rs6000-tdep.c (rs6000_skip_prologue): Likewise. * frv-tdep.c (frv_analyze_prologue): Add GDBARCH parameter, pass it to skip_prologue_using_sal. Update call sites ... (frv_skip_prologue, frv_frame_unwind_cache): ... here. * mn10300-tdep.c (struct mn10300_prologue): Add GDBARCH member. (check_for_saved): Use it instead of current_gdbarch. (mn10300_analyze_prologue): Set it. * value.c (using_struct_return): Add GDBARCH parameter. Use it instead of current_gdbarch. * value.h (using_struct_return): Add GDBARCH parameter. * eval.c (evaluate_subexp_standard): Pass architecture to using_struct_return. * infcall.c (call_function_by_hand): Likewise. * stack.c (return_command): Likewise. * sparc-tdep.c (sparc32_push_dummy_code): Likewise. * symtab.c (in_prologue): Add GDBARCH parameter. Use it instead of current_gdbarch. * symtab.h (in_prologue): Add GDBARCH parameter. * infrun.c (handle_inferior_event): Pass architecture to in_prologue. * eval.c (evaluate_subexp_standard): Use expression architecture instead of current_gdbarch. * c-lang.c (evaluate_subexp_c): Use expression architecture and language instead of current_gdbarch and current_language. * printcmd.c (do_one_display): Use expression architecture instead of current_gdbarch. * infcmd.c (print_return_value): Use architecture of stop_regcache instead of current_gdbarch. (print_vector_info, print_float_info): Remove GDBARCH argument, use frame architecture instead. (vector_info, float_info): Update calls. * objc-lang.c (objc_skip_trampoline): Use frame architecture instead of current_gdbarch. * parse.c (write_dollar_variable): Use parse architecture instead of current_gdbarch. * source.c (line_info): Use objfile architecture instead of current_gdbarch. * symtab.c (find_function_start_sal): Use gdbarch instead of current_gdbarch. (print_msymbol_info): Use objfile architecture instead of current_gdbarch. * valops.c (value_assign): Use frame architecture instead of current_gdbarch.
2009-06-17 20:43:24 +02:00
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
Split struct symtab into two: struct symtab and compunit_symtab. Currently "symtabs" in gdb are stored as a single linked list of struct symtab that contains both symbol symtabs (the blockvectors) and file symtabs (the linetables). This has led to confusion, bugs, and performance issues. This patch is conceptually very simple: split struct symtab into two pieces: one part containing things common across the entire compilation unit, and one part containing things specific to each source file. Example. For the case of a program built out of these files: foo.c foo1.h foo2.h bar.c foo1.h bar.h Today we have a single list of struct symtabs: objfile -> foo.c -> foo1.h -> foo2.h -> bar.c -> foo1.h -> bar.h -> NULL where "->" means the "next" pointer in struct symtab. With this patch, that turns into: objfile -> foo.c(cu) -> bar.c(cu) -> NULL | | v v foo.c bar.c | | v v foo1.h foo1.h | | v v foo2.h bar.h | | v v NULL NULL where "foo.c(cu)" and "bar.c(cu)" are struct compunit_symtab objects, and the files foo.c, etc. are struct symtab objects. So now, for example, when we want to iterate over all blockvectors we can now just iterate over the compunit_symtab list. Plus a lot of the data that was either unused or replicated for each symtab in a compilation unit now lives in struct compunit_symtab. E.g., the objfile pointer, the producer string, etc. I thought of moving "language" out of struct symtab but there is logic to try to compute the language based on previously seen files, and I think that's best left as is for now. With my standard monster benchmark with -readnow (which I can't actually do, but based on my calculations), whereas today the list requires 77MB to store all the struct symtabs, it now only requires 37MB. A modest space savings given the gigabytes needed for all the debug info, etc. Still, it's nice. Plus, whereas today we create a copy of dirname for each source file symtab in a compilation unit, we now only create one for the compunit. So this patch is basically just a data structure reorg, I don't expect significant performance improvements from it. Notes: 1) A followup patch can do a similar split for struct partial_symtab. I have left that until after I get the changes I want in to better utilize .gdb_index (it may affect how we do partial syms). 2) Another followup patch *could* rename struct symtab. The term "symtab" is ambiguous and has been a source of confusion. In this patch I'm leaving it alone, calling it the "historical" name of "filetabs", which is what they are now: just the file-name + line-table. gdb/ChangeLog: Split struct symtab into two: struct symtab and compunit_symtab. * amd64-tdep.c (amd64_skip_xmm_prologue): Fetch producer from compunit. * block.c (blockvector_for_pc_sect): Change "struct symtab *" argument to "struct compunit_symtab *". All callers updated. (set_block_compunit_symtab): Renamed from set_block_symtab. Change "struct symtab *" argument to "struct compunit_symtab *". All callers updated. (get_block_compunit_symtab): Renamed from get_block_symtab. Change result to "struct compunit_symtab *". All callers updated. (find_iterator_compunit_symtab): Renamed from find_iterator_symtab. Change result to "struct compunit_symtab *". All callers updated. * block.h (struct global_block) <compunit_symtab>: Renamed from symtab. hange type to "struct compunit_symtab *". All uses updated. (struct block_iterator) <d.compunit_symtab>: Renamed from "d.symtab". Change type to "struct compunit_symtab *". All uses updated. * buildsym.c (struct buildsym_compunit): New struct. (subfiles, buildsym_compdir, buildsym_objfile, main_subfile): Delete. (buildsym_compunit): New static global. (finish_block_internal): Update to fetch objfile from buildsym_compunit. (make_blockvector): Delete objfile argument. (start_subfile): Rewrite to use buildsym_compunit. Don't initialize debugformat, producer. (start_buildsym_compunit): New function. (free_buildsym_compunit): Renamed from free_subfiles_list. All callers updated. (patch_subfile_names): Rewrite to use buildsym_compunit. (get_compunit_symtab): New function. (get_macro_table): Delete argument comp_dir. All callers updated. (start_symtab): Change result to "struct compunit_symtab *". All callers updated. Create the subfile of the main source file. (watch_main_source_file_lossage): Rewrite to use buildsym_compunit. (reset_symtab_globals): Update. (end_symtab_get_static_block): Update to use buildsym_compunit. (end_symtab_without_blockvector): Rewrite. (end_symtab_with_blockvector): Change result to "struct compunit_symtab *". All callers updated. Update to use buildsym_compunit. Don't set symtab->dirname, instead set it in the compunit. Explicitly make sure main symtab is first in its list. Set debugformat, producer, blockvector, block_line_section, and macrotable in the compunit. (end_symtab_from_static_block): Change result to "struct compunit_symtab *". All callers updated. (end_symtab, end_expandable_symtab): Ditto. (set_missing_symtab): Change symtab argument to "struct compunit_symtab *". All callers updated. (augment_type_symtab): Ditto. (record_debugformat): Update to use buildsym_compunit. (record_producer): Update to use buildsym_compunit. * buildsym.h (struct subfile) <dirname>: Delete. <producer, debugformat>: Delete. <buildsym_compunit>: New member. (get_compunit_symtab): Declare. * dwarf2read.c (struct type_unit_group) <compunit_symtab>: Renamed from primary_symtab. Change type to "struct compunit_symtab *". All uses updated. (dwarf2_start_symtab): Change result to "struct compunit_symtab *". All callers updated. (dwarf_decode_macros): Delete comp_dir argument. All callers updated. (struct dwarf2_per_cu_quick_data) <compunit_symtab>: Renamed from symtab. Change type to "struct compunit_symtab *". All uses updated. (dw2_instantiate_symtab): Change result to "struct compunit_symtab *". All callers updated. (dw2_find_last_source_symtab): Ditto. (dw2_lookup_symbol): Ditto. (recursively_find_pc_sect_compunit_symtab): Renamed from recursively_find_pc_sect_symtab. Change result to "struct compunit_symtab *". All callers updated. (dw2_find_pc_sect_compunit_symtab): Renamed from dw2_find_pc_sect_symtab. Change result to "struct compunit_symtab *". All callers updated. (get_compunit_symtab): Renamed from get_symtab. Change result to "struct compunit_symtab *". All callers updated. (recursively_compute_inclusions): Change type of immediate_parent argument to "struct compunit_symtab *". All callers updated. (compute_compunit_symtab_includes): Renamed from compute_symtab_includes. All callers updated. Rewrite to compute includes of compunit_symtabs and not symtabs. (process_full_comp_unit): Update to work with struct compunit_symtab. (process_full_type_unit): Ditto. (dwarf_decode_lines_1): Delete argument comp_dir. All callers updated. (dwarf_decode_lines): Remove special case handling of main subfile. (macro_start_file): Delete argument comp_dir. All callers updated. (dwarf_decode_macro_bytes): Ditto. * guile/scm-block.c (bkscm_print_block_syms_progress_smob): Update to use struct compunit_symtab. * i386-tdep.c (i386_skip_prologue): Fetch producer from compunit. * jit.c (finalize_symtab): Build compunit_symtab. * jv-lang.c (get_java_class_symtab): Change result to "struct compunit_symtab *". All callers updated. * macroscope.c (sal_macro_scope): Fetch macro table from compunit. * macrotab.c (struct macro_table) <compunit_symtab>: Renamed from comp_dir. Change type to "struct compunit_symtab *". All uses updated. (new_macro_table): Change comp_dir argument to cust, "struct compunit_symtab *". All callers updated. * maint.c (struct cmd_stats) <nr_compunit_symtabs>: Renamed from nr_primary_symtabs. All uses updated. (count_symtabs_and_blocks): Update to handle compunits. (report_command_stats): Update output, "primary symtabs" renamed to "compunits". * mdebugread.c (new_symtab): Change result to "struct compunit_symtab *". All callers updated. (parse_procedure): Change type of search_symtab argument to "struct compunit_symtab *". All callers updated. * objfiles.c (objfile_relocate1): Loop over blockvectors in a separate loop. * objfiles.h (struct objfile) <compunit_symtabs>: Renamed from symtabs. Change type to "struct compunit_symtab *". All uses updated. (ALL_OBJFILE_FILETABS): Renamed from ALL_OBJFILE_SYMTABS. All uses updated. (ALL_OBJFILE_COMPUNITS): Renamed from ALL_OBJFILE_PRIMARY_SYMTABS. All uses updated. (ALL_FILETABS): Renamed from ALL_SYMTABS. All uses updated. (ALL_COMPUNITS): Renamed from ALL_PRIMARY_SYMTABS. All uses updated. * psympriv.h (struct partial_symtab) <compunit_symtab>: Renamed from symtab. Change type to "struct compunit_symtab *". All uses updated. * psymtab.c (psymtab_to_symtab): Change result type to "struct compunit_symtab *". All callers updated. (find_pc_sect_compunit_symtab_from_partial): Renamed from find_pc_sect_symtab_from_partial. Change result type to "struct compunit_symtab *". All callers updated. (lookup_symbol_aux_psymtabs): Change result type to "struct compunit_symtab *". All callers updated. (find_last_source_symtab_from_partial): Ditto. * python/py-symtab.c (stpy_get_producer): Fetch producer from compunit. * source.c (forget_cached_source_info_for_objfile): Fetch debugformat and macro_table from compunit. * symfile-debug.c (debug_qf_find_last_source_symtab): Change result type to "struct compunit_symtab *". All callers updated. (debug_qf_lookup_symbol): Ditto. (debug_qf_find_pc_sect_compunit_symtab): Renamed from debug_qf_find_pc_sect_symtab, change result type to "struct compunit_symtab *". All callers updated. * symfile.c (allocate_symtab): Delete objfile argument. New argument cust. (allocate_compunit_symtab): New function. (add_compunit_symtab_to_objfile): New function. * symfile.h (struct quick_symbol_functions) <lookup_symbol>: Change result type to "struct compunit_symtab *". All uses updated. <find_pc_sect_compunit_symtab>: Renamed from find_pc_sect_symtab. Change result type to "struct compunit_symtab *". All uses updated. * symmisc.c (print_objfile_statistics): Compute blockvector count in separate loop. (dump_symtab_1): Update test for primary source symtab. (maintenance_info_symtabs): Update to handle compunit symtabs. (maintenance_check_symtabs): Ditto. * symtab.c (set_primary_symtab): Delete. (compunit_primary_filetab): New function. (compunit_language): New function. (iterate_over_some_symtabs): Change type of arguments "first", "after_last" to "struct compunit_symtab *". All callers updated. Update to loop over symtabs in each compunit. (error_in_psymtab_expansion): Rename symtab argument to cust, and change type to "struct compunit_symtab *". All callers updated. (find_pc_sect_compunit_symtab): Renamed from find_pc_sect_symtab. Change result type to "struct compunit_symtab *". All callers updated. (find_pc_compunit_symtab): Renamed from find_pc_symtab. Change result type to "struct compunit_symtab *". All callers updated. (find_pc_sect_line): Only loop over symtabs within selected compunit instead of all symtabs in the objfile. * symtab.h (struct symtab) <blockvector>: Moved to compunit_symtab. <compunit_symtab> New member. <block_line_section>: Moved to compunit_symtab. <locations_valid>: Ditto. <epilogue_unwind_valid>: Ditto. <macro_table>: Ditto. <dirname>: Ditto. <debugformat>: Ditto. <producer>: Ditto. <objfile>: Ditto. <call_site_htab>: Ditto. <includes>: Ditto. <user>: Ditto. <primary>: Delete (SYMTAB_COMPUNIT): New macro. (SYMTAB_BLOCKVECTOR): Update definition. (SYMTAB_OBJFILE): Update definition. (SYMTAB_DIRNAME): Update definition. (struct compunit_symtab): New type. Common members among all source symtabs within a compilation unit moved here. All uses updated. (COMPUNIT_OBJFILE): New macro. (COMPUNIT_FILETABS): New macro. (COMPUNIT_DEBUGFORMAT): New macro. (COMPUNIT_PRODUCER): New macro. (COMPUNIT_DIRNAME): New macro. (COMPUNIT_BLOCKVECTOR): New macro. (COMPUNIT_BLOCK_LINE_SECTION): New macro. (COMPUNIT_LOCATIONS_VALID): New macro. (COMPUNIT_EPILOGUE_UNWIND_VALID): New macro. (COMPUNIT_CALL_SITE_HTAB): New macro. (COMPUNIT_MACRO_TABLE): New macro. (ALL_COMPUNIT_FILETABS): New macro. (compunit_symtab_ptr): New typedef. (DEF_VEC_P (compunit_symtab_ptr)): New vector type. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Update expected output.
2014-11-20 16:42:48 +01:00
struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);
if (post_prologue_pc)
post_prologue_pc
= arm_skip_stack_protector (post_prologue_pc, gdbarch);
/* GCC always emits a line note before the prologue and another
one after, even if the two are at the same address or on the
same line. Take advantage of this so that we do not need to
know every instruction that might appear in the prologue. We
will have producer information for most binaries; if it is
missing (e.g. for -gstabs), assuming the GNU tools. */
if (post_prologue_pc
Split struct symtab into two: struct symtab and compunit_symtab. Currently "symtabs" in gdb are stored as a single linked list of struct symtab that contains both symbol symtabs (the blockvectors) and file symtabs (the linetables). This has led to confusion, bugs, and performance issues. This patch is conceptually very simple: split struct symtab into two pieces: one part containing things common across the entire compilation unit, and one part containing things specific to each source file. Example. For the case of a program built out of these files: foo.c foo1.h foo2.h bar.c foo1.h bar.h Today we have a single list of struct symtabs: objfile -> foo.c -> foo1.h -> foo2.h -> bar.c -> foo1.h -> bar.h -> NULL where "->" means the "next" pointer in struct symtab. With this patch, that turns into: objfile -> foo.c(cu) -> bar.c(cu) -> NULL | | v v foo.c bar.c | | v v foo1.h foo1.h | | v v foo2.h bar.h | | v v NULL NULL where "foo.c(cu)" and "bar.c(cu)" are struct compunit_symtab objects, and the files foo.c, etc. are struct symtab objects. So now, for example, when we want to iterate over all blockvectors we can now just iterate over the compunit_symtab list. Plus a lot of the data that was either unused or replicated for each symtab in a compilation unit now lives in struct compunit_symtab. E.g., the objfile pointer, the producer string, etc. I thought of moving "language" out of struct symtab but there is logic to try to compute the language based on previously seen files, and I think that's best left as is for now. With my standard monster benchmark with -readnow (which I can't actually do, but based on my calculations), whereas today the list requires 77MB to store all the struct symtabs, it now only requires 37MB. A modest space savings given the gigabytes needed for all the debug info, etc. Still, it's nice. Plus, whereas today we create a copy of dirname for each source file symtab in a compilation unit, we now only create one for the compunit. So this patch is basically just a data structure reorg, I don't expect significant performance improvements from it. Notes: 1) A followup patch can do a similar split for struct partial_symtab. I have left that until after I get the changes I want in to better utilize .gdb_index (it may affect how we do partial syms). 2) Another followup patch *could* rename struct symtab. The term "symtab" is ambiguous and has been a source of confusion. In this patch I'm leaving it alone, calling it the "historical" name of "filetabs", which is what they are now: just the file-name + line-table. gdb/ChangeLog: Split struct symtab into two: struct symtab and compunit_symtab. * amd64-tdep.c (amd64_skip_xmm_prologue): Fetch producer from compunit. * block.c (blockvector_for_pc_sect): Change "struct symtab *" argument to "struct compunit_symtab *". All callers updated. (set_block_compunit_symtab): Renamed from set_block_symtab. Change "struct symtab *" argument to "struct compunit_symtab *". All callers updated. (get_block_compunit_symtab): Renamed from get_block_symtab. Change result to "struct compunit_symtab *". All callers updated. (find_iterator_compunit_symtab): Renamed from find_iterator_symtab. Change result to "struct compunit_symtab *". All callers updated. * block.h (struct global_block) <compunit_symtab>: Renamed from symtab. hange type to "struct compunit_symtab *". All uses updated. (struct block_iterator) <d.compunit_symtab>: Renamed from "d.symtab". Change type to "struct compunit_symtab *". All uses updated. * buildsym.c (struct buildsym_compunit): New struct. (subfiles, buildsym_compdir, buildsym_objfile, main_subfile): Delete. (buildsym_compunit): New static global. (finish_block_internal): Update to fetch objfile from buildsym_compunit. (make_blockvector): Delete objfile argument. (start_subfile): Rewrite to use buildsym_compunit. Don't initialize debugformat, producer. (start_buildsym_compunit): New function. (free_buildsym_compunit): Renamed from free_subfiles_list. All callers updated. (patch_subfile_names): Rewrite to use buildsym_compunit. (get_compunit_symtab): New function. (get_macro_table): Delete argument comp_dir. All callers updated. (start_symtab): Change result to "struct compunit_symtab *". All callers updated. Create the subfile of the main source file. (watch_main_source_file_lossage): Rewrite to use buildsym_compunit. (reset_symtab_globals): Update. (end_symtab_get_static_block): Update to use buildsym_compunit. (end_symtab_without_blockvector): Rewrite. (end_symtab_with_blockvector): Change result to "struct compunit_symtab *". All callers updated. Update to use buildsym_compunit. Don't set symtab->dirname, instead set it in the compunit. Explicitly make sure main symtab is first in its list. Set debugformat, producer, blockvector, block_line_section, and macrotable in the compunit. (end_symtab_from_static_block): Change result to "struct compunit_symtab *". All callers updated. (end_symtab, end_expandable_symtab): Ditto. (set_missing_symtab): Change symtab argument to "struct compunit_symtab *". All callers updated. (augment_type_symtab): Ditto. (record_debugformat): Update to use buildsym_compunit. (record_producer): Update to use buildsym_compunit. * buildsym.h (struct subfile) <dirname>: Delete. <producer, debugformat>: Delete. <buildsym_compunit>: New member. (get_compunit_symtab): Declare. * dwarf2read.c (struct type_unit_group) <compunit_symtab>: Renamed from primary_symtab. Change type to "struct compunit_symtab *". All uses updated. (dwarf2_start_symtab): Change result to "struct compunit_symtab *". All callers updated. (dwarf_decode_macros): Delete comp_dir argument. All callers updated. (struct dwarf2_per_cu_quick_data) <compunit_symtab>: Renamed from symtab. Change type to "struct compunit_symtab *". All uses updated. (dw2_instantiate_symtab): Change result to "struct compunit_symtab *". All callers updated. (dw2_find_last_source_symtab): Ditto. (dw2_lookup_symbol): Ditto. (recursively_find_pc_sect_compunit_symtab): Renamed from recursively_find_pc_sect_symtab. Change result to "struct compunit_symtab *". All callers updated. (dw2_find_pc_sect_compunit_symtab): Renamed from dw2_find_pc_sect_symtab. Change result to "struct compunit_symtab *". All callers updated. (get_compunit_symtab): Renamed from get_symtab. Change result to "struct compunit_symtab *". All callers updated. (recursively_compute_inclusions): Change type of immediate_parent argument to "struct compunit_symtab *". All callers updated. (compute_compunit_symtab_includes): Renamed from compute_symtab_includes. All callers updated. Rewrite to compute includes of compunit_symtabs and not symtabs. (process_full_comp_unit): Update to work with struct compunit_symtab. (process_full_type_unit): Ditto. (dwarf_decode_lines_1): Delete argument comp_dir. All callers updated. (dwarf_decode_lines): Remove special case handling of main subfile. (macro_start_file): Delete argument comp_dir. All callers updated. (dwarf_decode_macro_bytes): Ditto. * guile/scm-block.c (bkscm_print_block_syms_progress_smob): Update to use struct compunit_symtab. * i386-tdep.c (i386_skip_prologue): Fetch producer from compunit. * jit.c (finalize_symtab): Build compunit_symtab. * jv-lang.c (get_java_class_symtab): Change result to "struct compunit_symtab *". All callers updated. * macroscope.c (sal_macro_scope): Fetch macro table from compunit. * macrotab.c (struct macro_table) <compunit_symtab>: Renamed from comp_dir. Change type to "struct compunit_symtab *". All uses updated. (new_macro_table): Change comp_dir argument to cust, "struct compunit_symtab *". All callers updated. * maint.c (struct cmd_stats) <nr_compunit_symtabs>: Renamed from nr_primary_symtabs. All uses updated. (count_symtabs_and_blocks): Update to handle compunits. (report_command_stats): Update output, "primary symtabs" renamed to "compunits". * mdebugread.c (new_symtab): Change result to "struct compunit_symtab *". All callers updated. (parse_procedure): Change type of search_symtab argument to "struct compunit_symtab *". All callers updated. * objfiles.c (objfile_relocate1): Loop over blockvectors in a separate loop. * objfiles.h (struct objfile) <compunit_symtabs>: Renamed from symtabs. Change type to "struct compunit_symtab *". All uses updated. (ALL_OBJFILE_FILETABS): Renamed from ALL_OBJFILE_SYMTABS. All uses updated. (ALL_OBJFILE_COMPUNITS): Renamed from ALL_OBJFILE_PRIMARY_SYMTABS. All uses updated. (ALL_FILETABS): Renamed from ALL_SYMTABS. All uses updated. (ALL_COMPUNITS): Renamed from ALL_PRIMARY_SYMTABS. All uses updated. * psympriv.h (struct partial_symtab) <compunit_symtab>: Renamed from symtab. Change type to "struct compunit_symtab *". All uses updated. * psymtab.c (psymtab_to_symtab): Change result type to "struct compunit_symtab *". All callers updated. (find_pc_sect_compunit_symtab_from_partial): Renamed from find_pc_sect_symtab_from_partial. Change result type to "struct compunit_symtab *". All callers updated. (lookup_symbol_aux_psymtabs): Change result type to "struct compunit_symtab *". All callers updated. (find_last_source_symtab_from_partial): Ditto. * python/py-symtab.c (stpy_get_producer): Fetch producer from compunit. * source.c (forget_cached_source_info_for_objfile): Fetch debugformat and macro_table from compunit. * symfile-debug.c (debug_qf_find_last_source_symtab): Change result type to "struct compunit_symtab *". All callers updated. (debug_qf_lookup_symbol): Ditto. (debug_qf_find_pc_sect_compunit_symtab): Renamed from debug_qf_find_pc_sect_symtab, change result type to "struct compunit_symtab *". All callers updated. * symfile.c (allocate_symtab): Delete objfile argument. New argument cust. (allocate_compunit_symtab): New function. (add_compunit_symtab_to_objfile): New function. * symfile.h (struct quick_symbol_functions) <lookup_symbol>: Change result type to "struct compunit_symtab *". All uses updated. <find_pc_sect_compunit_symtab>: Renamed from find_pc_sect_symtab. Change result type to "struct compunit_symtab *". All uses updated. * symmisc.c (print_objfile_statistics): Compute blockvector count in separate loop. (dump_symtab_1): Update test for primary source symtab. (maintenance_info_symtabs): Update to handle compunit symtabs. (maintenance_check_symtabs): Ditto. * symtab.c (set_primary_symtab): Delete. (compunit_primary_filetab): New function. (compunit_language): New function. (iterate_over_some_symtabs): Change type of arguments "first", "after_last" to "struct compunit_symtab *". All callers updated. Update to loop over symtabs in each compunit. (error_in_psymtab_expansion): Rename symtab argument to cust, and change type to "struct compunit_symtab *". All callers updated. (find_pc_sect_compunit_symtab): Renamed from find_pc_sect_symtab. Change result type to "struct compunit_symtab *". All callers updated. (find_pc_compunit_symtab): Renamed from find_pc_symtab. Change result type to "struct compunit_symtab *". All callers updated. (find_pc_sect_line): Only loop over symtabs within selected compunit instead of all symtabs in the objfile. * symtab.h (struct symtab) <blockvector>: Moved to compunit_symtab. <compunit_symtab> New member. <block_line_section>: Moved to compunit_symtab. <locations_valid>: Ditto. <epilogue_unwind_valid>: Ditto. <macro_table>: Ditto. <dirname>: Ditto. <debugformat>: Ditto. <producer>: Ditto. <objfile>: Ditto. <call_site_htab>: Ditto. <includes>: Ditto. <user>: Ditto. <primary>: Delete (SYMTAB_COMPUNIT): New macro. (SYMTAB_BLOCKVECTOR): Update definition. (SYMTAB_OBJFILE): Update definition. (SYMTAB_DIRNAME): Update definition. (struct compunit_symtab): New type. Common members among all source symtabs within a compilation unit moved here. All uses updated. (COMPUNIT_OBJFILE): New macro. (COMPUNIT_FILETABS): New macro. (COMPUNIT_DEBUGFORMAT): New macro. (COMPUNIT_PRODUCER): New macro. (COMPUNIT_DIRNAME): New macro. (COMPUNIT_BLOCKVECTOR): New macro. (COMPUNIT_BLOCK_LINE_SECTION): New macro. (COMPUNIT_LOCATIONS_VALID): New macro. (COMPUNIT_EPILOGUE_UNWIND_VALID): New macro. (COMPUNIT_CALL_SITE_HTAB): New macro. (COMPUNIT_MACRO_TABLE): New macro. (ALL_COMPUNIT_FILETABS): New macro. (compunit_symtab_ptr): New typedef. (DEF_VEC_P (compunit_symtab_ptr)): New vector type. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Update expected output.
2014-11-20 16:42:48 +01:00
&& (cust == NULL
|| COMPUNIT_PRODUCER (cust) == NULL
|| startswith (COMPUNIT_PRODUCER (cust), "GNU ")
|| startswith (COMPUNIT_PRODUCER (cust), "clang ")))
return post_prologue_pc;
if (post_prologue_pc != 0)
{
CORE_ADDR analyzed_limit;
/* For non-GCC compilers, make sure the entire line is an
acceptable prologue; GDB will round this function's
return value up to the end of the following line so we
can not skip just part of a line (and we do not want to).
RealView does not treat the prologue specially, but does
associate prologue code with the opening brace; so this
lets us skip the first line if we think it is the opening
brace. */
if (arm_pc_is_thumb (gdbarch, func_addr))
analyzed_limit = thumb_analyze_prologue (gdbarch, func_addr,
post_prologue_pc, NULL);
else
analyzed_limit = arm_analyze_prologue (gdbarch, func_addr,
post_prologue_pc, NULL);
if (analyzed_limit != post_prologue_pc)
return func_addr;
return post_prologue_pc;
}
}
/* Can't determine prologue from the symbol table, need to examine
instructions. */
/* Find an upper limit on the function prologue using the debug
information. If the debug information could not be used to provide
that bound, then use an arbitrary large number as the upper bound. */
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Like arm_scan_prologue, stop no later than pc + 64. */
* dummy-frame.c (deprecated_pc_in_call_dummy): Add GDBARCH parameter, use it instead of current_gdbarch. * frame.h (deprecated_pc_in_call_dummy): Add GDBARCH parameter. * arm-tdep.c (arm_skip_prologue): Pass architecture to deprecated_pc_in_call_dummy. * symtab.c (skip_prologue_using_sal): Add GDBARCH parameter. Use it instead of current_gdbarch. * symtab.h (skip_prologue_using_sal): Add GDBARCH parameter. * breakpoint.c (expand_line_sal_maybe): Pass architecture to skip_prologue_using_sal. * arm-tdep.c (skip_prologue_using_sal): Likewise. * lm32-tdep.c (lm32_skip_prologue): Likewise. * m32-tdep.c (m32c_skip_prologue): Likewise. * mips-tdep.c (mips_skip_prologue): Likewise. * moxie-tdep.c (moxie_skip_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * rs6000-tdep.c (rs6000_skip_prologue): Likewise. * frv-tdep.c (frv_analyze_prologue): Add GDBARCH parameter, pass it to skip_prologue_using_sal. Update call sites ... (frv_skip_prologue, frv_frame_unwind_cache): ... here. * mn10300-tdep.c (struct mn10300_prologue): Add GDBARCH member. (check_for_saved): Use it instead of current_gdbarch. (mn10300_analyze_prologue): Set it. * value.c (using_struct_return): Add GDBARCH parameter. Use it instead of current_gdbarch. * value.h (using_struct_return): Add GDBARCH parameter. * eval.c (evaluate_subexp_standard): Pass architecture to using_struct_return. * infcall.c (call_function_by_hand): Likewise. * stack.c (return_command): Likewise. * sparc-tdep.c (sparc32_push_dummy_code): Likewise. * symtab.c (in_prologue): Add GDBARCH parameter. Use it instead of current_gdbarch. * symtab.h (in_prologue): Add GDBARCH parameter. * infrun.c (handle_inferior_event): Pass architecture to in_prologue. * eval.c (evaluate_subexp_standard): Use expression architecture instead of current_gdbarch. * c-lang.c (evaluate_subexp_c): Use expression architecture and language instead of current_gdbarch and current_language. * printcmd.c (do_one_display): Use expression architecture instead of current_gdbarch. * infcmd.c (print_return_value): Use architecture of stop_regcache instead of current_gdbarch. (print_vector_info, print_float_info): Remove GDBARCH argument, use frame architecture instead. (vector_info, float_info): Update calls. * objc-lang.c (objc_skip_trampoline): Use frame architecture instead of current_gdbarch. * parse.c (write_dollar_variable): Use parse architecture instead of current_gdbarch. * source.c (line_info): Use objfile architecture instead of current_gdbarch. * symtab.c (find_function_start_sal): Use gdbarch instead of current_gdbarch. (print_msymbol_info): Use objfile architecture instead of current_gdbarch. * valops.c (value_assign): Use frame architecture instead of current_gdbarch.
2009-06-17 20:43:24 +02:00
limit_pc = skip_prologue_using_sal (gdbarch, pc);
if (limit_pc == 0)
limit_pc = pc + 64; /* Magic. */
/* Check if this is Thumb code. */
if (arm_pc_is_thumb (gdbarch, pc))
return thumb_analyze_prologue (gdbarch, pc, limit_pc, NULL);
Improve arm_skip_prologue by using arm_analyze_prologue Hi, I see many fails in dw2-dir-file-name.exp on arm target when test case is compiled with -marm, however, these fails are disappeared when test case is compiled with -mthumb. The difference of pass and fail shown below is that "0x000085d4 in" isn't printed out, but test case expects to see it. -Breakpoint 2, compdir_missing__ldir_missing__file_basename () at tmp-dw2-dir-file-name.c:999^M -(gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: compdir_missing__ldir_missing__file_basename: continue to breakpoint: compdir_missing__ldir_missing__file_basename +Breakpoint 2, 0x000085d4 in compdir_missing__ldir_missing__file_basename () at tmp-dw2-dir-file-name.c:999^M +(gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: compdir_missing__ldir_missing__file_basename: continue to breakpoint: compdir_missing__ldir_missing__file_basename This difference is caused by setting breakpoint at the first instruction in the function (actually, the first instruction in prologue, at [1]), so that frame_show_address returns false, and print_frame doesn't print the address. 0x00008620 <+0>: push {r11} ; (str r11, [sp, #-4]!) <--[1] 0x00008624 <+4>: add r11, sp, #0 0x00008628 <+8>: ldr r3, [pc, #24] ; 0x8648 <compdir_missing__ldir_missing__file_basename+40> 0x0000862c <+12>: ldr r3, [r3] 0x00008630 <+16>: add r3, r3, #1 0x00008634 <+20>: ldr r2, [pc, #12] ; 0x8648 <compdir_missing__ldir_missing__file_basename+40> Then, it must be the arm_skip_prologue's fault that unable to skip instructions in prologue. At the end of arm_skip_prologue, it matches several instructions, such as "str r(0123),[r11,#-nn]" and "str r(0123),[sp,#nn]", but "push {r11}" isn't handled. These instruction matching code in arm_skip_prologue, which can be regarded as leftover of development for many years, should be merged to arm_analyze_prologue and use arm_analyze_prologue in arm_skip_prologue. Here is the something like the history of arm_{skip,scan,analyze}_prologue. Around 2002, there are arm_skip_prologue and arm_scan_prologue, but code are duplicated to some extent. When match an instruction, both functions should be modified, for example in Michael Snyder's patch https://sourceware.org/ml/gdb-patches/2002-05/msg00205.html and Michael expressed the willingness to merge both into one. Daniel added code call thumb_analyze_prologue in arm_skip_prologue in 2006, but didn't handle its counterpart arm_analyze_prologue, which is added in 2010 <https://sourceware.org/ml/gdb-patches/2010-03/msg00820.html> however, the instructions matching at the bottom of arm_skip_prologue wasn't cleaned up. This patch is to merge them into arm_analyze_prologue. gdb: 2014-12-12 Yao Qi <yao@codesourcery.com> PR tdep/14261 * arm-tdep.c (arm_skip_prologue): Remove unused local variable 'skip_pc'. Remove code skipping prologue instructions, use arm_analyze_prologue instead. (arm_analyze_prologue): Stop the scanning for unrecognized instruction when skipping prologue.
2014-11-27 04:37:54 +01:00
else
return arm_analyze_prologue (gdbarch, pc, limit_pc, NULL);
}
1999-07-07 22:19:36 +02:00
/* *INDENT-OFF* */
/* Function: thumb_scan_prologue (helper function for arm_scan_prologue)
This function decodes a Thumb function prologue to determine:
1) the size of the stack frame
2) which registers are saved on it
3) the offsets of saved regs
4) the offset from the stack pointer to the frame pointer
2000-02-01 04:19:29 +01:00
A typical Thumb function prologue would create this stack frame
(offsets relative to FP)
old SP -> 24 stack parameters
20 LR
16 R7
R7 -> 0 local variables (16 bytes)
SP -> -12 additional stack space (12 bytes)
The frame size would thus be 36 bytes, and the frame offset would be
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
12 bytes. The frame register is R7.
2000-02-01 04:19:29 +01:00
The comments for thumb_skip_prolog() describe the algorithm we use
to detect the end of the prolog. */
1999-07-07 22:19:36 +02:00
/* *INDENT-ON* */
static void
* alpha-tdep.c (alpha_heuristic_proc_start) (alpha_sigtramp_register_address): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. (alpha_heuristic_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_heuristic_proc_start call. (alpha_sigtramp_frame_this_id, alpha_sigtramp_frame_prev_register): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_sigtramp_register_address call. * arm-tdep.c (thumb_scan_prologue): Add gdbarch as parameter and replace current_gdbarch by gdbarch. Update caller. (convert_to_extended, convert_from_extended): Add endianess parameter for comparison. Update caller. (arm_extract_return_value, arm_store_return_value): Use get_regcache_arch to get at the current architecture. * cris-tdep.c (cris_register_size): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. (cris_gdb_func, move_to_preg_op, none_reg_mode_move_from_preg_op): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM, E_PSEUDO_EXR_REGNUM, BINWORD): Add gdbarch as parameter. Update caller. (h8300_init_frame_cache): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and update caller. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_trampoline_code): Use get_frame_arch to get at the current architecture. Replace current_gdbarch by gdbarch. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. (STACK_CORRECTION, USE_PAGE_REGISTER): Replace M6811_TDEP by its expression. Add gdbarch as parameter and replace current_gdbarch with it. Update caller. (M6811_TDEP): Remove. (m68hc11_frame_prev_register): Use get_frame_arch to get at the current architecture. (m68hc11_scan_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * m68k-tdep.c (m68k_analyze_prologue): Add gdbarch as parameter and update caller. (m68k_analyze_register_saves): Likewise. Also replace current_gdbarch by gdbarch. * rs6000-tdep.c (skip_prologue): Add gdbarch as parameter and update caller. Relace current_gdbarch by gdbarch. (altivec_register_p, spe_register_p): Likewise. * ppc-tdep.h (altivec_register_p, spe_register_p): Add gdbarch as parameter. * ppc-linux-nat.c (fetch_register, store_register): Update caller of altivec_register_p and spe_register_p. * score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. (score_analyze_prologue): use get_frame_arch to get at the current architecture. * sparc-tdep.h (sparc_analyze_prologue): Add gdbarch as parameter. * sparc-tdep.c (sparc_analyze_prologue): Likewise. Replace current_gdbarch by gdbarch. Update caller. (sparc_frame_cache): Use get_frame_arch to get at the current architecture. * sparce64-tdep.c (sparc64_skip_prologue): Update call of sparc_analyze_prologue. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Add gdbarch as parameter.
2008-01-11 15:43:15 +01:00
thumb_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR prev_pc,
CORE_ADDR block_addr, struct arm_prologue_cache *cache)
{
CORE_ADDR prologue_start;
CORE_ADDR prologue_end;
if (find_pc_partial_function (block_addr, NULL, &prologue_start,
&prologue_end))
{
/* See comment in arm_scan_prologue for an explanation of
this heuristics. */
if (prologue_end > prologue_start + 64)
{
prologue_end = prologue_start + 64;
}
}
else
/* We're in the boondocks: we have no idea where the start of the
function is. */
return;
gdb: Use std::min and std::max throughout Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-09-16 20:55:17 +02:00
prologue_end = std::min (prologue_end, prev_pc);
* alpha-tdep.c (alpha_heuristic_proc_start) (alpha_sigtramp_register_address): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. (alpha_heuristic_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_heuristic_proc_start call. (alpha_sigtramp_frame_this_id, alpha_sigtramp_frame_prev_register): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_sigtramp_register_address call. * arm-tdep.c (thumb_scan_prologue): Add gdbarch as parameter and replace current_gdbarch by gdbarch. Update caller. (convert_to_extended, convert_from_extended): Add endianess parameter for comparison. Update caller. (arm_extract_return_value, arm_store_return_value): Use get_regcache_arch to get at the current architecture. * cris-tdep.c (cris_register_size): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. (cris_gdb_func, move_to_preg_op, none_reg_mode_move_from_preg_op): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM, E_PSEUDO_EXR_REGNUM, BINWORD): Add gdbarch as parameter. Update caller. (h8300_init_frame_cache): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and update caller. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_trampoline_code): Use get_frame_arch to get at the current architecture. Replace current_gdbarch by gdbarch. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. (STACK_CORRECTION, USE_PAGE_REGISTER): Replace M6811_TDEP by its expression. Add gdbarch as parameter and replace current_gdbarch with it. Update caller. (M6811_TDEP): Remove. (m68hc11_frame_prev_register): Use get_frame_arch to get at the current architecture. (m68hc11_scan_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * m68k-tdep.c (m68k_analyze_prologue): Add gdbarch as parameter and update caller. (m68k_analyze_register_saves): Likewise. Also replace current_gdbarch by gdbarch. * rs6000-tdep.c (skip_prologue): Add gdbarch as parameter and update caller. Relace current_gdbarch by gdbarch. (altivec_register_p, spe_register_p): Likewise. * ppc-tdep.h (altivec_register_p, spe_register_p): Add gdbarch as parameter. * ppc-linux-nat.c (fetch_register, store_register): Update caller of altivec_register_p and spe_register_p. * score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. (score_analyze_prologue): use get_frame_arch to get at the current architecture. * sparc-tdep.h (sparc_analyze_prologue): Add gdbarch as parameter. * sparc-tdep.c (sparc_analyze_prologue): Likewise. Replace current_gdbarch by gdbarch. Update caller. (sparc_frame_cache): Use get_frame_arch to get at the current architecture. * sparce64-tdep.c (sparc64_skip_prologue): Update call of sparc_analyze_prologue. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Add gdbarch as parameter.
2008-01-11 15:43:15 +01:00
thumb_analyze_prologue (gdbarch, prologue_start, prologue_end, cache);
}
/* Return 1 if the ARM instruction INSN restores SP in epilogue, 0
otherwise. */
static int
arm_instruction_restores_sp (unsigned int insn)
{
if (bits (insn, 28, 31) != INST_NV)
{
if ((insn & 0x0df0f000) == 0x0080d000
/* ADD SP (register or immediate). */
|| (insn & 0x0df0f000) == 0x0040d000
/* SUB SP (register or immediate). */
|| (insn & 0x0ffffff0) == 0x01a0d000
/* MOV SP. */
|| (insn & 0x0fff0000) == 0x08bd0000
/* POP (LDMIA). */
|| (insn & 0x0fff0000) == 0x049d0000)
/* POP of a single register. */
return 1;
}
return 0;
}
/* Analyze an ARM mode prologue starting at PROLOGUE_START and
continuing no further than PROLOGUE_END. If CACHE is non-NULL,
fill it in. Return the first address not recognized as a prologue
instruction.
We recognize all the instructions typically found in ARM prologues,
plus harmless instructions which can be skipped (either for analysis
purposes, or a more restrictive set that can be skipped when finding
the end of the prologue). */
static CORE_ADDR
arm_analyze_prologue (struct gdbarch *gdbarch,
CORE_ADDR prologue_start, CORE_ADDR prologue_end,
struct arm_prologue_cache *cache)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int regno;
CORE_ADDR offset, current_pc;
pv_t regs[ARM_FPS_REGNUM];
CORE_ADDR unrecognized_pc = 0;
/* Search the prologue looking for instructions that set up the
1999-08-09 23:36:23 +02:00
frame pointer, adjust the stack pointer, and save registers.
1999-12-22 22:45:38 +01:00
1999-08-09 23:36:23 +02:00
Be careful, however, and if it doesn't look like a prologue,
don't try to scan it. If, for instance, a frameless function
begins with stmfd sp!, then we will tell ourselves there is
a frame, which will confuse stack traceback, as well as "finish"
1999-08-09 23:36:23 +02:00
and other operations that rely on a knowledge of the stack
traceback. */
for (regno = 0; regno < ARM_FPS_REGNUM; regno++)
regs[regno] = pv_register (regno, 0);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
pv_area stack (ARM_SP_REGNUM, gdbarch_addr_bit (gdbarch));
for (current_pc = prologue_start;
current_pc < prologue_end;
current_pc += 4)
1999-08-09 23:36:23 +02:00
{
* 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 19:25:59 +02:00
unsigned int insn
= read_code_unsigned_integer (current_pc, 4, byte_order_for_code);
if (insn == 0xe1a0c00d) /* mov ip, sp */
{
regs[ARM_IP_REGNUM] = regs[ARM_SP_REGNUM];
continue;
}
else if ((insn & 0xfff00000) == 0xe2800000 /* add Rd, Rn, #n */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
int rd = bits (insn, 12, 15);
imm = (imm >> rot) | (imm << (32 - rot));
regs[rd] = pv_add_constant (regs[bits (insn, 16, 19)], imm);
continue;
}
else if ((insn & 0xfff00000) == 0xe2400000 /* sub Rd, Rn, #n */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
int rd = bits (insn, 12, 15);
imm = (imm >> rot) | (imm << (32 - rot));
regs[rd] = pv_add_constant (regs[bits (insn, 16, 19)], -imm);
continue;
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
else if ((insn & 0xffff0fff) == 0xe52d0004) /* str Rd,
[sp, #-4]! */
{
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -4);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (regs[ARM_SP_REGNUM], 4,
regs[bits (insn, 12, 15)]);
continue;
}
else if ((insn & 0xffff0000) == 0xe92d0000)
/* stmfd sp!, {..., fp, ip, lr, pc}
or
stmfd sp!, {a1, a2, a3, a4} */
{
int mask = insn & 0xffff;
1999-12-22 22:45:38 +01:00
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
/* Calculate offsets of saved registers. */
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
for (regno = ARM_PC_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
regs[ARM_SP_REGNUM]
= pv_add_constant (regs[ARM_SP_REGNUM], -4);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (regs[ARM_SP_REGNUM], 4, regs[regno]);
}
}
else if ((insn & 0xffff0000) == 0xe54b0000 /* strb rx,[r11,#-n] */
|| (insn & 0xffff00f0) == 0xe14b00b0 /* strh rx,[r11,#-n] */
|| (insn & 0xffffc000) == 0xe50b0000) /* str rx,[r11,#-n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
else if ((insn & 0xffff0000) == 0xe5cd0000 /* strb rx,[sp,#n] */
|| (insn & 0xffff00f0) == 0xe1cd00b0 /* strh rx,[sp,#n] */
|| (insn & 0xffffc000) == 0xe58d0000) /* str rx,[sp,#n] */
{
/* No need to add this to saved_regs -- it's just an arg reg. */
continue;
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
else if ((insn & 0xfff00000) == 0xe8800000 /* stm Rn,
{ registers } */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
{
/* No need to add this to saved_regs -- it's just arg regs. */
continue;
}
else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
regs[ARM_FP_REGNUM] = pv_add_constant (regs[ARM_IP_REGNUM], -imm);
}
else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
{
unsigned imm = insn & 0xff; /* immediate value */
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -imm);
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
else if ((insn & 0xffff7fff) == 0xed6d0103 /* stfe f?,
[sp, -#c]! */
&& gdbarch_tdep (gdbarch)->have_fpa_registers)
{
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -12);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
regno = ARM_F0_REGNUM + ((insn >> 12) & 0x07);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (regs[ARM_SP_REGNUM], 12, regs[regno]);
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
else if ((insn & 0xffbf0fff) == 0xec2d0200 /* sfmfd f0, 4,
[sp!] */
&& gdbarch_tdep (gdbarch)->have_fpa_registers)
{
int n_saved_fp_regs;
unsigned int fp_start_reg, fp_bound_reg;
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.store_would_trash (regs[ARM_SP_REGNUM]))
break;
if ((insn & 0x800) == 0x800) /* N0 is set */
1999-08-09 23:36:23 +02:00
{
if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 3;
else
n_saved_fp_regs = 1;
1999-08-09 23:36:23 +02:00
}
else
1999-08-09 23:36:23 +02:00
{
if ((insn & 0x40000) == 0x40000) /* N1 is set */
n_saved_fp_regs = 2;
else
n_saved_fp_regs = 4;
1999-08-09 23:36:23 +02:00
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
fp_start_reg = ARM_F0_REGNUM + ((insn >> 12) & 0x7);
fp_bound_reg = fp_start_reg + n_saved_fp_regs;
for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
1999-08-09 23:36:23 +02:00
{
regs[ARM_SP_REGNUM] = pv_add_constant (regs[ARM_SP_REGNUM], -12);
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
stack.store (regs[ARM_SP_REGNUM], 12,
regs[fp_start_reg++]);
1999-08-09 23:36:23 +02:00
}
}
else if ((insn & 0xff000000) == 0xeb000000 && cache == NULL) /* bl */
{
/* Allow some special function calls when skipping the
prologue; GCC generates these before storing arguments to
the stack. */
CORE_ADDR dest = BranchDest (current_pc, insn);
if (skip_prologue_function (gdbarch, dest, 0))
continue;
else
break;
}
else if ((insn & 0xf0000000) != 0xe0000000)
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
break; /* Condition not true, exit early. */
else if (arm_instruction_changes_pc (insn))
/* Don't scan past anything that might change control flow. */
break;
else if (arm_instruction_restores_sp (insn))
{
/* Don't scan past the epilogue. */
break;
}
else if ((insn & 0xfe500000) == 0xe8100000 /* ldm */
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
/* Ignore block loads from the stack, potentially copying
parameters from memory. */
continue;
else if ((insn & 0xfc500000) == 0xe4100000
&& pv_is_register (regs[bits (insn, 16, 19)], ARM_SP_REGNUM))
/* Similarly ignore single loads from the stack. */
continue;
else if ((insn & 0xffff0ff0) == 0xe1a00000)
/* MOV Rd, Rm. Skip register copies, i.e. saves to another
register instead of the stack. */
continue;
else
{
Improve arm_skip_prologue by using arm_analyze_prologue Hi, I see many fails in dw2-dir-file-name.exp on arm target when test case is compiled with -marm, however, these fails are disappeared when test case is compiled with -mthumb. The difference of pass and fail shown below is that "0x000085d4 in" isn't printed out, but test case expects to see it. -Breakpoint 2, compdir_missing__ldir_missing__file_basename () at tmp-dw2-dir-file-name.c:999^M -(gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: compdir_missing__ldir_missing__file_basename: continue to breakpoint: compdir_missing__ldir_missing__file_basename +Breakpoint 2, 0x000085d4 in compdir_missing__ldir_missing__file_basename () at tmp-dw2-dir-file-name.c:999^M +(gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: compdir_missing__ldir_missing__file_basename: continue to breakpoint: compdir_missing__ldir_missing__file_basename This difference is caused by setting breakpoint at the first instruction in the function (actually, the first instruction in prologue, at [1]), so that frame_show_address returns false, and print_frame doesn't print the address. 0x00008620 <+0>: push {r11} ; (str r11, [sp, #-4]!) <--[1] 0x00008624 <+4>: add r11, sp, #0 0x00008628 <+8>: ldr r3, [pc, #24] ; 0x8648 <compdir_missing__ldir_missing__file_basename+40> 0x0000862c <+12>: ldr r3, [r3] 0x00008630 <+16>: add r3, r3, #1 0x00008634 <+20>: ldr r2, [pc, #12] ; 0x8648 <compdir_missing__ldir_missing__file_basename+40> Then, it must be the arm_skip_prologue's fault that unable to skip instructions in prologue. At the end of arm_skip_prologue, it matches several instructions, such as "str r(0123),[r11,#-nn]" and "str r(0123),[sp,#nn]", but "push {r11}" isn't handled. These instruction matching code in arm_skip_prologue, which can be regarded as leftover of development for many years, should be merged to arm_analyze_prologue and use arm_analyze_prologue in arm_skip_prologue. Here is the something like the history of arm_{skip,scan,analyze}_prologue. Around 2002, there are arm_skip_prologue and arm_scan_prologue, but code are duplicated to some extent. When match an instruction, both functions should be modified, for example in Michael Snyder's patch https://sourceware.org/ml/gdb-patches/2002-05/msg00205.html and Michael expressed the willingness to merge both into one. Daniel added code call thumb_analyze_prologue in arm_skip_prologue in 2006, but didn't handle its counterpart arm_analyze_prologue, which is added in 2010 <https://sourceware.org/ml/gdb-patches/2010-03/msg00820.html> however, the instructions matching at the bottom of arm_skip_prologue wasn't cleaned up. This patch is to merge them into arm_analyze_prologue. gdb: 2014-12-12 Yao Qi <yao@codesourcery.com> PR tdep/14261 * arm-tdep.c (arm_skip_prologue): Remove unused local variable 'skip_pc'. Remove code skipping prologue instructions, use arm_analyze_prologue instead. (arm_analyze_prologue): Stop the scanning for unrecognized instruction when skipping prologue.
2014-11-27 04:37:54 +01:00
/* The optimizer might shove anything into the prologue, if
we build up cache (cache != NULL) from scanning prologue,
we just skip what we don't recognize and scan further to
make cache as complete as possible. However, if we skip
prologue, we'll stop immediately on unrecognized
instruction. */
unrecognized_pc = current_pc;
Improve arm_skip_prologue by using arm_analyze_prologue Hi, I see many fails in dw2-dir-file-name.exp on arm target when test case is compiled with -marm, however, these fails are disappeared when test case is compiled with -mthumb. The difference of pass and fail shown below is that "0x000085d4 in" isn't printed out, but test case expects to see it. -Breakpoint 2, compdir_missing__ldir_missing__file_basename () at tmp-dw2-dir-file-name.c:999^M -(gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: compdir_missing__ldir_missing__file_basename: continue to breakpoint: compdir_missing__ldir_missing__file_basename +Breakpoint 2, 0x000085d4 in compdir_missing__ldir_missing__file_basename () at tmp-dw2-dir-file-name.c:999^M +(gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: compdir_missing__ldir_missing__file_basename: continue to breakpoint: compdir_missing__ldir_missing__file_basename This difference is caused by setting breakpoint at the first instruction in the function (actually, the first instruction in prologue, at [1]), so that frame_show_address returns false, and print_frame doesn't print the address. 0x00008620 <+0>: push {r11} ; (str r11, [sp, #-4]!) <--[1] 0x00008624 <+4>: add r11, sp, #0 0x00008628 <+8>: ldr r3, [pc, #24] ; 0x8648 <compdir_missing__ldir_missing__file_basename+40> 0x0000862c <+12>: ldr r3, [r3] 0x00008630 <+16>: add r3, r3, #1 0x00008634 <+20>: ldr r2, [pc, #12] ; 0x8648 <compdir_missing__ldir_missing__file_basename+40> Then, it must be the arm_skip_prologue's fault that unable to skip instructions in prologue. At the end of arm_skip_prologue, it matches several instructions, such as "str r(0123),[r11,#-nn]" and "str r(0123),[sp,#nn]", but "push {r11}" isn't handled. These instruction matching code in arm_skip_prologue, which can be regarded as leftover of development for many years, should be merged to arm_analyze_prologue and use arm_analyze_prologue in arm_skip_prologue. Here is the something like the history of arm_{skip,scan,analyze}_prologue. Around 2002, there are arm_skip_prologue and arm_scan_prologue, but code are duplicated to some extent. When match an instruction, both functions should be modified, for example in Michael Snyder's patch https://sourceware.org/ml/gdb-patches/2002-05/msg00205.html and Michael expressed the willingness to merge both into one. Daniel added code call thumb_analyze_prologue in arm_skip_prologue in 2006, but didn't handle its counterpart arm_analyze_prologue, which is added in 2010 <https://sourceware.org/ml/gdb-patches/2010-03/msg00820.html> however, the instructions matching at the bottom of arm_skip_prologue wasn't cleaned up. This patch is to merge them into arm_analyze_prologue. gdb: 2014-12-12 Yao Qi <yao@codesourcery.com> PR tdep/14261 * arm-tdep.c (arm_skip_prologue): Remove unused local variable 'skip_pc'. Remove code skipping prologue instructions, use arm_analyze_prologue instead. (arm_analyze_prologue): Stop the scanning for unrecognized instruction when skipping prologue.
2014-11-27 04:37:54 +01:00
if (cache != NULL)
continue;
else
break;
}
}
if (unrecognized_pc == 0)
unrecognized_pc = current_pc;
if (cache)
{
int framereg, framesize;
/* The frame size is just the distance from the frame register
to the original stack pointer. */
if (pv_is_register (regs[ARM_FP_REGNUM], ARM_SP_REGNUM))
{
/* Frame pointer is fp. */
framereg = ARM_FP_REGNUM;
framesize = -regs[ARM_FP_REGNUM].k;
}
else
{
/* Try the stack pointer... this is a bit desperate. */
framereg = ARM_SP_REGNUM;
framesize = -regs[ARM_SP_REGNUM].k;
}
cache->framereg = framereg;
cache->framesize = framesize;
for (regno = 0; regno < ARM_FPS_REGNUM; regno++)
C++-ify prologue-value's pv_area This patch is an initial C++-ification of pv_area, from prologue-value. It turns pv_area into a class with a constructor and destructor; renames the data members; and changes various functions to be member functions. This allows the removal of make_cleanup_free_pv_area. gdb/ChangeLog 2017-10-12 Tom Tromey <tom@tromey.com> * s390-linux-tdep.c (s390_store, s390_load) (s390_check_for_saved, s390_analyze_prologue): Update. * rx-tdep.c (check_for_saved, rx_analyze_prologue): Update. * rl78-tdep.c (rl78_analyze_prologue, check_for_saved): Update. * prologue-value.h (class pv_area): Move from prologue-value.c. Change names of members. Add constructor, destructor, member functions. (make_pv_area, free_pv_area, make_cleanup_free_pv_area) (pv_area_store, pv_area_fetch, pv_area_store_would_trash) (pv_area_fetch, pv_area_scan): Don't declare. * prologue-value.c (struct pv_area::area_entry): Now member of pv_area. (struct pv_area): Move to prologue-value.h. (pv_area::pv_area): Rename from make_pv_area. (pv_area::~pv_area): Rename from free_pv_area. (do_free_pv_area_cleanup, make_cleanup_free_pv_area): Remove. (clear_entries, find_entry, overlaps, store_would_trash, store) (fetch, find_reg, scan): Now member of pv_area. Remove "area" argument. Update. * msp430-tdep.c (check_for_saved, msp430_analyze_prologue): Update. * mn10300-tdep.c (push_reg, check_for_saved) (mn10300_analyze_prologue): Update. * mep-tdep.c (is_arg_spill, check_for_saved) (mep_analyze_prologue): Update. * m32c-tdep.c (m32c_pv_push, m32c_srcdest_fetch) (m32c_srcdest_store, m32c_pv_enter, m32c_is_arg_spill) (m32c_is_struct_return, m32c_analyze_prologue): Update. * arm-tdep.c (thumb_analyze_prologue, arm_analyze_prologue): Update. * arc-tdep.c (arc_is_in_prologue, arc_analyze_prologue): Update. * aarch64-tdep.c (aarch64_analyze_prologue): Update.
2017-10-08 02:23:36 +02:00
if (stack.find_reg (gdbarch, regno, &offset))
cache->saved_regs[regno].addr = offset;
}
if (arm_debug)
fprintf_unfiltered (gdb_stdlog, "Prologue scan stopped at %s\n",
paddress (gdbarch, unrecognized_pc));
return unrecognized_pc;
}
static void
arm_scan_prologue (struct frame_info *this_frame,
struct arm_prologue_cache *cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR prologue_start, prologue_end;
CORE_ADDR prev_pc = get_frame_pc (this_frame);
CORE_ADDR block_addr = get_frame_address_in_block (this_frame);
/* Assume there is no frame until proven otherwise. */
cache->framereg = ARM_SP_REGNUM;
cache->framesize = 0;
/* Check for Thumb prologue. */
if (arm_frame_is_thumb (this_frame))
{
thumb_scan_prologue (gdbarch, prev_pc, block_addr, cache);
return;
}
/* Find the function prologue. If we can't find the function in
the symbol table, peek in the stack frame to find the PC. */
if (find_pc_partial_function (block_addr, NULL, &prologue_start,
&prologue_end))
{
/* One way to find the end of the prologue (which works well
for unoptimized code) is to do the following:
struct symtab_and_line sal = find_pc_line (prologue_start, 0);
if (sal.line == 0)
prologue_end = prev_pc;
else if (sal.end < prologue_end)
prologue_end = sal.end;
This mechanism is very accurate so long as the optimizer
doesn't move any instructions from the function body into the
prologue. If this happens, sal.end will be the last
instruction in the first hunk of prologue code just before
the first instruction that the scheduler has moved from
the body to the prologue.
In order to make sure that we scan all of the prologue
instructions, we use a slightly less accurate mechanism which
may scan more than necessary. To help compensate for this
lack of accuracy, the prologue scanning loop below contains
several clauses which'll cause the loop to terminate early if
an implausible prologue instruction is encountered.
The expression
prologue_start + 64
is a suitable endpoint since it accounts for the largest
possible prologue plus up to five instructions inserted by
the scheduler. */
if (prologue_end > prologue_start + 64)
{
prologue_end = prologue_start + 64; /* See above. */
}
}
else
{
/* We have no symbol information. Our only option is to assume this
function has a standard stack frame and the normal frame register.
Then, we can find the value of our frame pointer on entrance to
the callee (or at the present moment if this is the innermost frame).
The value stored there should be the address of the stmfd + 8. */
CORE_ADDR frame_loc;
ULONGEST return_value;
/* AAPCS does not use a frame register, so we can abort here. */
if (gdbarch_tdep (gdbarch)->arm_abi == ARM_ABI_AAPCS)
return;
frame_loc = get_frame_register_unsigned (this_frame, ARM_FP_REGNUM);
if (!safe_read_memory_unsigned_integer (frame_loc, 4, byte_order,
&return_value))
return;
else
{
prologue_start = gdbarch_addr_bits_remove
(gdbarch, return_value) - 8;
prologue_end = prologue_start + 64; /* See above. */
}
}
if (prev_pc < prologue_end)
prologue_end = prev_pc;
arm_analyze_prologue (gdbarch, prologue_start, prologue_end, cache);
}
static struct arm_prologue_cache *
arm_make_prologue_cache (struct frame_info *this_frame)
{
int reg;
struct arm_prologue_cache *cache;
CORE_ADDR unwound_fp;
1999-07-07 22:19:36 +02:00
cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
arm_scan_prologue (this_frame, cache);
unwound_fp = get_frame_register_unsigned (this_frame, cache->framereg);
if (unwound_fp == 0)
return cache;
cache->prev_sp = unwound_fp + cache->framesize;
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
if (trad_frame_addr_p (cache->saved_regs, reg))
cache->saved_regs[reg].addr += cache->prev_sp;
return cache;
}
/* Implementation of the stop_reason hook for arm_prologue frames. */
static enum unwind_stop_reason
arm_prologue_unwind_stop_reason (struct frame_info *this_frame,
void **this_cache)
{
struct arm_prologue_cache *cache;
CORE_ADDR pc;
if (*this_cache == NULL)
*this_cache = arm_make_prologue_cache (this_frame);
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
cache = (struct arm_prologue_cache *) *this_cache;
/* This is meant to halt the backtrace at "_start". */
pc = get_frame_pc (this_frame);
if (pc <= gdbarch_tdep (get_frame_arch (this_frame))->lowest_pc)
return UNWIND_OUTERMOST;
/* If we've hit a wall, stop. */
if (cache->prev_sp == 0)
return UNWIND_OUTERMOST;
return UNWIND_NO_REASON;
}
/* Our frame ID for a normal frame is the current function's starting PC
and the caller's SP when we were called. */
static void
arm_prologue_this_id (struct frame_info *this_frame,
void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
struct frame_id id;
CORE_ADDR pc, func;
2001-12-20 22:40:22 +01:00
if (*this_cache == NULL)
*this_cache = arm_make_prologue_cache (this_frame);
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
cache = (struct arm_prologue_cache *) *this_cache;
/* Use function start address as part of the frame ID. If we cannot
identify the start address (due to missing symbol information),
fall back to just using the current PC. */
pc = get_frame_pc (this_frame);
func = get_frame_func (this_frame);
if (!func)
func = pc;
id = frame_id_build (cache->prev_sp, func);
*this_id = id;
}
static struct value *
arm_prologue_prev_register (struct frame_info *this_frame,
void **this_cache,
int prev_regnum)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct arm_prologue_cache *cache;
if (*this_cache == NULL)
*this_cache = arm_make_prologue_cache (this_frame);
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
cache = (struct arm_prologue_cache *) *this_cache;
/* If we are asked to unwind the PC, then we need to return the LR
instead. The prologue may save PC, but it will point into this
frame's prologue, not the next frame's resume location. Also
strip the saved T bit. A valid LR may have the low bit set, but
a valid PC never does. */
if (prev_regnum == ARM_PC_REGNUM)
{
CORE_ADDR lr;
lr = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM);
return frame_unwind_got_constant (this_frame, prev_regnum,
arm_addr_bits_remove (gdbarch, lr));
}
/* SP is generally not saved to the stack, but this frame is
identified by the next frame's stack pointer at the time of the call.
The value was already reconstructed into PREV_SP. */
if (prev_regnum == ARM_SP_REGNUM)
return frame_unwind_got_constant (this_frame, prev_regnum, cache->prev_sp);
/* The CPSR may have been changed by the call instruction and by the
called function. The only bit we can reconstruct is the T bit,
by checking the low bit of LR as of the call. This is a reliable
indicator of Thumb-ness except for some ARM v4T pre-interworking
Thumb code, which could get away with a clear low bit as long as
the called function did not use bx. Guess that all other
bits are unchanged; the condition flags are presumably lost,
but the processor status is likely valid. */
if (prev_regnum == ARM_PS_REGNUM)
{
CORE_ADDR lr, cpsr;
ULONGEST t_bit = arm_psr_thumb_bit (gdbarch);
cpsr = get_frame_register_unsigned (this_frame, prev_regnum);
lr = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM);
if (IS_THUMB_ADDR (lr))
cpsr |= t_bit;
else
cpsr &= ~t_bit;
return frame_unwind_got_constant (this_frame, prev_regnum, cpsr);
}
return trad_frame_get_prev_register (this_frame, cache->saved_regs,
prev_regnum);
}
struct frame_unwind arm_prologue_unwind = {
NORMAL_FRAME,
arm_prologue_unwind_stop_reason,
arm_prologue_this_id,
arm_prologue_prev_register,
NULL,
default_frame_sniffer
};
/* Maintain a list of ARM exception table entries per objfile, similar to the
list of mapping symbols. We only cache entries for standard ARM-defined
personality routines; the cache will contain only the frame unwinding
instructions associated with the entry (not the descriptors). */
struct arm_exidx_entry
{
CORE_ADDR addr;
gdb_byte *entry;
bool operator< (const arm_exidx_entry &other) const
{
return addr < other.addr;
}
};
struct arm_exidx_data
{
std::vector<std::vector<arm_exidx_entry>> section_maps;
};
/* Per-BFD key to store exception handling information. */
static const struct bfd_key<arm_exidx_data> arm_exidx_data_key;
static struct obj_section *
arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma)
{
struct obj_section *osect;
ALL_OBJFILE_OSECTIONS (objfile, osect)
bfd_section_* macros This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
if (bfd_section_flags (osect->the_bfd_section) & SEC_ALLOC)
{
bfd_vma start, size;
bfd_section_* macros This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
start = bfd_section_vma (osect->the_bfd_section);
size = bfd_section_size (osect->the_bfd_section);
if (start <= vma && vma < start + size)
return osect;
}
return NULL;
}
/* Parse contents of exception table and exception index sections
of OBJFILE, and fill in the exception table entry cache.
For each entry that refers to a standard ARM-defined personality
routine, extract the frame unwinding instructions (from either
the index or the table section). The unwinding instructions
are normalized by:
- extracting them from the rest of the table data
- converting to host endianness
- appending the implicit 0xb0 ("Finish") code
The extracted and normalized instructions are stored for later
retrieval by the arm_find_exidx_entry routine. */
static void
arm_exidx_new_objfile (struct objfile *objfile)
{
struct arm_exidx_data *data;
asection *exidx, *extab;
bfd_vma exidx_vma = 0, extab_vma = 0;
LONGEST i;
/* If we've already touched this file, do nothing. */
if (!objfile || arm_exidx_data_key.get (objfile->obfd) != NULL)
return;
/* Read contents of exception table and index. */
exidx = bfd_get_section_by_name (objfile->obfd, ELF_STRING_ARM_unwind);
gdb::byte_vector exidx_data;
if (exidx)
{
bfd_section_* macros This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
exidx_vma = bfd_section_vma (exidx);
exidx_data.resize (bfd_section_size (exidx));
if (!bfd_get_section_contents (objfile->obfd, exidx,
exidx_data.data (), 0,
exidx_data.size ()))
return;
}
extab = bfd_get_section_by_name (objfile->obfd, ".ARM.extab");
gdb::byte_vector extab_data;
if (extab)
{
bfd_section_* macros This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
extab_vma = bfd_section_vma (extab);
extab_data.resize (bfd_section_size (extab));
if (!bfd_get_section_contents (objfile->obfd, extab,
extab_data.data (), 0,
extab_data.size ()))
return;
}
/* Allocate exception table data structure. */
data = arm_exidx_data_key.emplace (objfile->obfd);
data->section_maps.resize (objfile->obfd->section_count);
/* Fill in exception table. */
for (i = 0; i < exidx_data.size () / 8; i++)
{
struct arm_exidx_entry new_exidx_entry;
bfd_vma idx = bfd_h_get_32 (objfile->obfd, exidx_data.data () + i * 8);
bfd_vma val = bfd_h_get_32 (objfile->obfd,
exidx_data.data () + i * 8 + 4);
bfd_vma addr = 0, word = 0;
int n_bytes = 0, n_words = 0;
struct obj_section *sec;
gdb_byte *entry = NULL;
/* Extract address of start of function. */
idx = ((idx & 0x7fffffff) ^ 0x40000000) - 0x40000000;
idx += exidx_vma + i * 8;
/* Find section containing function and compute section offset. */
sec = arm_obj_section_from_vma (objfile, idx);
if (sec == NULL)
continue;
bfd_section_* macros This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 12:55:17 +02:00
idx -= bfd_section_vma (sec->the_bfd_section);
/* Determine address of exception table entry. */
if (val == 1)
{
/* EXIDX_CANTUNWIND -- no exception table entry present. */
}
else if ((val & 0xff000000) == 0x80000000)
{
/* Exception table entry embedded in .ARM.exidx
-- must be short form. */
word = val;
n_bytes = 3;
}
else if (!(val & 0x80000000))
{
/* Exception table entry in .ARM.extab. */
addr = ((val & 0x7fffffff) ^ 0x40000000) - 0x40000000;
addr += exidx_vma + i * 8 + 4;
if (addr >= extab_vma && addr + 4 <= extab_vma + extab_data.size ())
{
word = bfd_h_get_32 (objfile->obfd,
extab_data.data () + addr - extab_vma);
addr += 4;
if ((word & 0xff000000) == 0x80000000)
{
/* Short form. */
n_bytes = 3;
}
else if ((word & 0xff000000) == 0x81000000
|| (word & 0xff000000) == 0x82000000)
{
/* Long form. */
n_bytes = 2;
n_words = ((word >> 16) & 0xff);
}
else if (!(word & 0x80000000))
{
bfd_vma pers;
struct obj_section *pers_sec;
int gnu_personality = 0;
/* Custom personality routine. */
pers = ((word & 0x7fffffff) ^ 0x40000000) - 0x40000000;
pers = UNMAKE_THUMB_ADDR (pers + addr - 4);
/* Check whether we've got one of the variants of the
GNU personality routines. */
pers_sec = arm_obj_section_from_vma (objfile, pers);
if (pers_sec)
{
static const char *personality[] =
{
"__gcc_personality_v0",
"__gxx_personality_v0",
"__gcj_personality_v0",
"__gnu_objc_personality_v0",
NULL
};
CORE_ADDR pc = pers + obj_section_offset (pers_sec);
int k;
for (k = 0; personality[k]; k++)
if (lookup_minimal_symbol_by_pc_name
(pc, personality[k], objfile))
{
gnu_personality = 1;
break;
}
}
/* If so, the next word contains a word count in the high
byte, followed by the same unwind instructions as the
pre-defined forms. */
if (gnu_personality
&& addr + 4 <= extab_vma + extab_data.size ())
{
word = bfd_h_get_32 (objfile->obfd,
(extab_data.data ()
+ addr - extab_vma));
addr += 4;
n_bytes = 3;
n_words = ((word >> 24) & 0xff);
}
}
}
}
/* Sanity check address. */
if (n_words)
if (addr < extab_vma
|| addr + 4 * n_words > extab_vma + extab_data.size ())
n_words = n_bytes = 0;
/* The unwind instructions reside in WORD (only the N_BYTES least
significant bytes are valid), followed by N_WORDS words in the
extab section starting at ADDR. */
if (n_bytes || n_words)
{
Add casts to memory allocation related calls Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-09-25 20:08:06 +02:00
gdb_byte *p = entry
= (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
n_bytes + n_words * 4 + 1);
while (n_bytes--)
*p++ = (gdb_byte) ((word >> (8 * n_bytes)) & 0xff);
while (n_words--)
{
word = bfd_h_get_32 (objfile->obfd,
extab_data.data () + addr - extab_vma);
addr += 4;
*p++ = (gdb_byte) ((word >> 24) & 0xff);
*p++ = (gdb_byte) ((word >> 16) & 0xff);
*p++ = (gdb_byte) ((word >> 8) & 0xff);
*p++ = (gdb_byte) (word & 0xff);
}
/* Implied "Finish" to terminate the list. */
*p++ = 0xb0;
}
/* Push entry onto vector. They are guaranteed to always
appear in order of increasing addresses. */
new_exidx_entry.addr = idx;
new_exidx_entry.entry = entry;
data->section_maps[sec->the_bfd_section->index].push_back
(new_exidx_entry);
}
}
/* Search for the exception table entry covering MEMADDR. If one is found,
return a pointer to its data. Otherwise, return 0. If START is non-NULL,
set *START to the start of the region covered by this entry. */
static gdb_byte *
arm_find_exidx_entry (CORE_ADDR memaddr, CORE_ADDR *start)
{
struct obj_section *sec;
sec = find_pc_section (memaddr);
if (sec != NULL)
{
struct arm_exidx_data *data;
struct arm_exidx_entry map_key = { memaddr - obj_section_addr (sec), 0 };
data = arm_exidx_data_key.get (sec->objfile->obfd);
if (data != NULL)
{
std::vector<arm_exidx_entry> &map
= data->section_maps[sec->the_bfd_section->index];
if (!map.empty ())
{
auto idx = std::lower_bound (map.begin (), map.end (), map_key);
/* std::lower_bound finds the earliest ordered insertion
point. If the following symbol starts at this exact
address, we use that; otherwise, the preceding
exception table entry covers this address. */
if (idx < map.end ())
{
if (idx->addr == map_key.addr)
{
if (start)
*start = idx->addr + obj_section_addr (sec);
return idx->entry;
}
}
if (idx > map.begin ())
{
idx = idx - 1;
if (start)
*start = idx->addr + obj_section_addr (sec);
return idx->entry;
}
}
}
}
return NULL;
}
/* Given the current frame THIS_FRAME, and its associated frame unwinding
instruction list from the ARM exception table entry ENTRY, allocate and
return a prologue cache structure describing how to unwind this frame.
Return NULL if the unwinding instruction list contains a "spare",
"reserved" or "refuse to unwind" instruction as defined in section
"9.3 Frame unwinding instructions" of the "Exception Handling ABI
for the ARM Architecture" document. */
static struct arm_prologue_cache *
arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry)
{
CORE_ADDR vsp = 0;
int vsp_valid = 0;
struct arm_prologue_cache *cache;
cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
for (;;)
{
gdb_byte insn;
/* Whenever we reload SP, we actually have to retrieve its
actual value in the current frame. */
if (!vsp_valid)
{
if (trad_frame_realreg_p (cache->saved_regs, ARM_SP_REGNUM))
{
int reg = cache->saved_regs[ARM_SP_REGNUM].realreg;
vsp = get_frame_register_unsigned (this_frame, reg);
}
else
{
CORE_ADDR addr = cache->saved_regs[ARM_SP_REGNUM].addr;
vsp = get_frame_memory_unsigned (this_frame, addr, 4);
}
vsp_valid = 1;
}
/* Decode next unwind instruction. */
insn = *entry++;
if ((insn & 0xc0) == 0)
{
int offset = insn & 0x3f;
vsp += (offset << 2) + 4;
}
else if ((insn & 0xc0) == 0x40)
{
int offset = insn & 0x3f;
vsp -= (offset << 2) + 4;
}
else if ((insn & 0xf0) == 0x80)
{
int mask = ((insn & 0xf) << 8) | *entry++;
int i;
/* The special case of an all-zero mask identifies
"Refuse to unwind". We return NULL to fall back
to the prologue analyzer. */
if (mask == 0)
return NULL;
/* Pop registers r4..r15 under mask. */
for (i = 0; i < 12; i++)
if (mask & (1 << i))
{
cache->saved_regs[4 + i].addr = vsp;
vsp += 4;
}
/* Special-case popping SP -- we need to reload vsp. */
if (mask & (1 << (ARM_SP_REGNUM - 4)))
vsp_valid = 0;
}
else if ((insn & 0xf0) == 0x90)
{
int reg = insn & 0xf;
/* Reserved cases. */
if (reg == ARM_SP_REGNUM || reg == ARM_PC_REGNUM)
return NULL;
/* Set SP from another register and mark VSP for reload. */
cache->saved_regs[ARM_SP_REGNUM] = cache->saved_regs[reg];
vsp_valid = 0;
}
else if ((insn & 0xf0) == 0xa0)
{
int count = insn & 0x7;
int pop_lr = (insn & 0x8) != 0;
int i;
/* Pop r4..r[4+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[4 + i].addr = vsp;
vsp += 4;
}
/* If indicated by flag, pop LR as well. */
if (pop_lr)
{
cache->saved_regs[ARM_LR_REGNUM].addr = vsp;
vsp += 4;
}
}
else if (insn == 0xb0)
{
/* We could only have updated PC by popping into it; if so, it
will show up as address. Otherwise, copy LR into PC. */
if (!trad_frame_addr_p (cache->saved_regs, ARM_PC_REGNUM))
cache->saved_regs[ARM_PC_REGNUM]
= cache->saved_regs[ARM_LR_REGNUM];
/* We're done. */
break;
}
else if (insn == 0xb1)
{
int mask = *entry++;
int i;
/* All-zero mask and mask >= 16 is "spare". */
if (mask == 0 || mask >= 16)
return NULL;
/* Pop r0..r3 under mask. */
for (i = 0; i < 4; i++)
if (mask & (1 << i))
{
cache->saved_regs[i].addr = vsp;
vsp += 4;
}
}
else if (insn == 0xb2)
{
ULONGEST offset = 0;
unsigned shift = 0;
do
{
offset |= (*entry & 0x7f) << shift;
shift += 7;
}
while (*entry++ & 0x80);
vsp += 0x204 + (offset << 2);
}
else if (insn == 0xb3)
{
int start = *entry >> 4;
int count = (*entry++) & 0xf;
int i;
/* Only registers D0..D15 are valid here. */
if (start + count >= 16)
return NULL;
/* Pop VFP double-precision registers D[start]..D[start+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[ARM_D0_REGNUM + start + i].addr = vsp;
vsp += 8;
}
/* Add an extra 4 bytes for FSTMFDX-style stack. */
vsp += 4;
}
else if ((insn & 0xf8) == 0xb8)
{
int count = insn & 0x7;
int i;
/* Pop VFP double-precision registers D[8]..D[8+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[ARM_D0_REGNUM + 8 + i].addr = vsp;
vsp += 8;
}
/* Add an extra 4 bytes for FSTMFDX-style stack. */
vsp += 4;
}
else if (insn == 0xc6)
{
int start = *entry >> 4;
int count = (*entry++) & 0xf;
int i;
/* Only registers WR0..WR15 are valid. */
if (start + count >= 16)
return NULL;
/* Pop iwmmx registers WR[start]..WR[start+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[ARM_WR0_REGNUM + start + i].addr = vsp;
vsp += 8;
}
}
else if (insn == 0xc7)
{
int mask = *entry++;
int i;
/* All-zero mask and mask >= 16 is "spare". */
if (mask == 0 || mask >= 16)
return NULL;
/* Pop iwmmx general-purpose registers WCGR0..WCGR3 under mask. */
for (i = 0; i < 4; i++)
if (mask & (1 << i))
{
cache->saved_regs[ARM_WCGR0_REGNUM + i].addr = vsp;
vsp += 4;
}
}
else if ((insn & 0xf8) == 0xc0)
{
int count = insn & 0x7;
int i;
/* Pop iwmmx registers WR[10]..WR[10+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[ARM_WR0_REGNUM + 10 + i].addr = vsp;
vsp += 8;
}
}
else if (insn == 0xc8)
{
int start = *entry >> 4;
int count = (*entry++) & 0xf;
int i;
/* Only registers D0..D31 are valid. */
if (start + count >= 16)
return NULL;
/* Pop VFP double-precision registers
D[16+start]..D[16+start+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[ARM_D0_REGNUM + 16 + start + i].addr = vsp;
vsp += 8;
}
}
else if (insn == 0xc9)
{
int start = *entry >> 4;
int count = (*entry++) & 0xf;
int i;
/* Pop VFP double-precision registers D[start]..D[start+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[ARM_D0_REGNUM + start + i].addr = vsp;
vsp += 8;
}
}
else if ((insn & 0xf8) == 0xd0)
{
int count = insn & 0x7;
int i;
/* Pop VFP double-precision registers D[8]..D[8+count]. */
for (i = 0; i <= count; i++)
{
cache->saved_regs[ARM_D0_REGNUM + 8 + i].addr = vsp;
vsp += 8;
}
}
else
{
/* Everything else is "spare". */
return NULL;
}
}
/* If we restore SP from a register, assume this was the frame register.
Otherwise just fall back to SP as frame register. */
if (trad_frame_realreg_p (cache->saved_regs, ARM_SP_REGNUM))
cache->framereg = cache->saved_regs[ARM_SP_REGNUM].realreg;
else
cache->framereg = ARM_SP_REGNUM;
/* Determine offset to previous frame. */
cache->framesize
= vsp - get_frame_register_unsigned (this_frame, cache->framereg);
/* We already got the previous SP. */
cache->prev_sp = vsp;
return cache;
}
/* Unwinding via ARM exception table entries. Note that the sniffer
already computes a filled-in prologue cache, which is then used
with the same arm_prologue_this_id and arm_prologue_prev_register
routines also used for prologue-parsing based unwinding. */
static int
arm_exidx_unwind_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_prologue_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
CORE_ADDR addr_in_block, exidx_region, func_start;
struct arm_prologue_cache *cache;
gdb_byte *entry;
/* See if we have an ARM exception table entry covering this address. */
addr_in_block = get_frame_address_in_block (this_frame);
entry = arm_find_exidx_entry (addr_in_block, &exidx_region);
if (!entry)
return 0;
/* The ARM exception table does not describe unwind information
for arbitrary PC values, but is guaranteed to be correct only
at call sites. We have to decide here whether we want to use
ARM exception table information for this frame, or fall back
to using prologue parsing. (Note that if we have DWARF CFI,
this sniffer isn't even called -- CFI is always preferred.)
Before we make this decision, however, we check whether we
actually have *symbol* information for the current frame.
If not, prologue parsing would not work anyway, so we might
as well use the exception table and hope for the best. */
if (find_pc_partial_function (addr_in_block, NULL, &func_start, NULL))
{
int exc_valid = 0;
/* If the next frame is "normal", we are at a call site in this
frame, so exception information is guaranteed to be valid. */
if (get_next_frame (this_frame)
&& get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME)
exc_valid = 1;
/* We also assume exception information is valid if we're currently
blocked in a system call. The system library is supposed to
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
ensure this, so that e.g. pthread cancellation works. */
if (arm_frame_is_thumb (this_frame))
{
ULONGEST insn;
[ARM] "svc" insn check at irrelevant address in ARM unwind info sniffer The following issue has been observed on arm-android, trying to step over the following line of code: Put_Line (">>> " & Integer'Image (Message (I))); Below is a copy of the GDB transcript: (gdb) cont Breakpoint 1, q.dump (message=...) at q.adb:11 11 Put_Line (">>> " & Integer'Image (Message (I))); (gdb) next 0x00016000 in system.concat_2.str_concat_2 () The expected behavior for the "next" command is to step over the call to Put_Line and stop at line 12: (gdb) next 12 I := I + 1; What happens during the next step is that the code for line 11 above make a call to system.concat_2.str_concat_2 (to implement the '&' string concatenation operator) before making the call to Put_Line. While stepping, GDB stops eventually stops at the first instruction of that function, and fails to detect that it's a function call from where we were before, and so decides to stop stepping. And the reason why it fails to detect that we landed inside a function call is because it fails to unwind from that function: (gdb) bt #0 0x00016000 in system.concat_2.str_concat_2 () #1 0x0001bc74 in ?? () Debugging GDB, I found that GDB decides to use the ARM unwind info for that function, which contains the following data: 0x16000 <system__concat_2__str_concat_2>: 0x80acb0b0 Compact model index: 0 0xac pop {r4, r5, r6, r7, r8, r14} 0xb0 finish 0xb0 finish But, in fact, using that data is wrong, in this case, because it mentions a pop of 6 registers, and therefore hints at a frame size of 24 bytes. The problem is that, because we're at the first instruction of the function, the 6 registers haven't been pushed to the stack yet. In other words, using the ARM unwind entry above, GDB is tricked into thinking that the frame size is 24 bytes, and that the return address (r14) is available on the stack. One visible manifestation of this issue can been seen by looking at the value of the stack pointer, and the frame's base address: (gdb) p /x $sp $2 = 0xbee427b0 (gdb) info frame Stack level 0, frame at 0xbee427c8: ^^^^^^^^^^ |||||||||| The frame's base address should be equal to the value of the stack pointer at entry. And you eventually get the correct frame address, as well as the correct backtrace if you just single-step one additional instruction, past the push: (gdb) x /i $pc => 0x16000 <system__concat_2__str_concat_2>: push {r4, r5, r6, r7, r8, lr} (gdb) stepi (gdb) bt #0 0x00016004 in system.concat_2.str_concat_2 () #1 0x00012b6c in q.dump (message=...) at q.adb:11 #2 0x00012c3c in q () at q.adb:19 Digging further, I found that GDB tries to use the ARM unwind info only when sure that it is relevant, as explained in the following comment: /* The ARM exception table does not describe unwind information for arbitrary PC values, but is guaranteed to be correct only at call sites. We have to decide here whether we want to use ARM exception table information for this frame, or fall back [...] There is one case where it decides that the info is relevant, described in the following comment: /* We also assume exception information is valid if we're currently blocked in a system call. The system library is supposed to ensure this, so that e.g. pthread cancellation works. For that, it just parses the instruction at the address it believes to be the point of call, and matches it against an "svc" instruction. For instance, for a non-thumb instruction, it is at... get_frame_pc (this_frame) - 4 ... and the code checking looks like the following. if (safe_read_memory_integer (get_frame_pc (this_frame) - 4, 4, byte_order_for_code, &insn) && (insn & 0x0f000000) == 0x0f000000 /* svc */) exc_valid = 1; However, the reason why this doesn't work in our case is that because we are at the first instruction of a function in the innermost frame. That frame can't possibly be making a call, and therefore be stuck on a system call. What the code above ends up doing is checking the instruction just before the start of our function, which in our case is not even an actual instruction, but unlucky for us, happens to match the pattern it is looking for, thus leading GDB to improperly trust the ARM unwinding data. gdb/ChangeLog: * arm-tdep.c (arm_exidx_unwind_sniffer): Do not check for a frame stuck on a system call if the given frame is the innermost frame.
2015-11-23 18:50:55 +01:00
if (safe_read_memory_unsigned_integer (get_frame_pc (this_frame) - 2,
2, byte_order_for_code, &insn)
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
&& (insn & 0xff00) == 0xdf00 /* svc */)
exc_valid = 1;
}
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
else
{
ULONGEST insn;
[ARM] "svc" insn check at irrelevant address in ARM unwind info sniffer The following issue has been observed on arm-android, trying to step over the following line of code: Put_Line (">>> " & Integer'Image (Message (I))); Below is a copy of the GDB transcript: (gdb) cont Breakpoint 1, q.dump (message=...) at q.adb:11 11 Put_Line (">>> " & Integer'Image (Message (I))); (gdb) next 0x00016000 in system.concat_2.str_concat_2 () The expected behavior for the "next" command is to step over the call to Put_Line and stop at line 12: (gdb) next 12 I := I + 1; What happens during the next step is that the code for line 11 above make a call to system.concat_2.str_concat_2 (to implement the '&' string concatenation operator) before making the call to Put_Line. While stepping, GDB stops eventually stops at the first instruction of that function, and fails to detect that it's a function call from where we were before, and so decides to stop stepping. And the reason why it fails to detect that we landed inside a function call is because it fails to unwind from that function: (gdb) bt #0 0x00016000 in system.concat_2.str_concat_2 () #1 0x0001bc74 in ?? () Debugging GDB, I found that GDB decides to use the ARM unwind info for that function, which contains the following data: 0x16000 <system__concat_2__str_concat_2>: 0x80acb0b0 Compact model index: 0 0xac pop {r4, r5, r6, r7, r8, r14} 0xb0 finish 0xb0 finish But, in fact, using that data is wrong, in this case, because it mentions a pop of 6 registers, and therefore hints at a frame size of 24 bytes. The problem is that, because we're at the first instruction of the function, the 6 registers haven't been pushed to the stack yet. In other words, using the ARM unwind entry above, GDB is tricked into thinking that the frame size is 24 bytes, and that the return address (r14) is available on the stack. One visible manifestation of this issue can been seen by looking at the value of the stack pointer, and the frame's base address: (gdb) p /x $sp $2 = 0xbee427b0 (gdb) info frame Stack level 0, frame at 0xbee427c8: ^^^^^^^^^^ |||||||||| The frame's base address should be equal to the value of the stack pointer at entry. And you eventually get the correct frame address, as well as the correct backtrace if you just single-step one additional instruction, past the push: (gdb) x /i $pc => 0x16000 <system__concat_2__str_concat_2>: push {r4, r5, r6, r7, r8, lr} (gdb) stepi (gdb) bt #0 0x00016004 in system.concat_2.str_concat_2 () #1 0x00012b6c in q.dump (message=...) at q.adb:11 #2 0x00012c3c in q () at q.adb:19 Digging further, I found that GDB tries to use the ARM unwind info only when sure that it is relevant, as explained in the following comment: /* The ARM exception table does not describe unwind information for arbitrary PC values, but is guaranteed to be correct only at call sites. We have to decide here whether we want to use ARM exception table information for this frame, or fall back [...] There is one case where it decides that the info is relevant, described in the following comment: /* We also assume exception information is valid if we're currently blocked in a system call. The system library is supposed to ensure this, so that e.g. pthread cancellation works. For that, it just parses the instruction at the address it believes to be the point of call, and matches it against an "svc" instruction. For instance, for a non-thumb instruction, it is at... get_frame_pc (this_frame) - 4 ... and the code checking looks like the following. if (safe_read_memory_integer (get_frame_pc (this_frame) - 4, 4, byte_order_for_code, &insn) && (insn & 0x0f000000) == 0x0f000000 /* svc */) exc_valid = 1; However, the reason why this doesn't work in our case is that because we are at the first instruction of a function in the innermost frame. That frame can't possibly be making a call, and therefore be stuck on a system call. What the code above ends up doing is checking the instruction just before the start of our function, which in our case is not even an actual instruction, but unlucky for us, happens to match the pattern it is looking for, thus leading GDB to improperly trust the ARM unwinding data. gdb/ChangeLog: * arm-tdep.c (arm_exidx_unwind_sniffer): Do not check for a frame stuck on a system call if the given frame is the innermost frame.
2015-11-23 18:50:55 +01:00
if (safe_read_memory_unsigned_integer (get_frame_pc (this_frame) - 4,
4, byte_order_for_code, &insn)
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
&& (insn & 0x0f000000) == 0x0f000000 /* svc */)
exc_valid = 1;
}
/* Bail out if we don't know that exception information is valid. */
if (!exc_valid)
return 0;
/* The ARM exception index does not mark the *end* of the region
covered by the entry, and some functions will not have any entry.
To correctly recognize the end of the covered region, the linker
should have inserted dummy records with a CANTUNWIND marker.
Unfortunately, current versions of GNU ld do not reliably do
this, and thus we may have found an incorrect entry above.
As a (temporary) sanity check, we only use the entry if it
lies *within* the bounds of the function. Note that this check
might reject perfectly valid entries that just happen to cover
multiple functions; therefore this check ought to be removed
once the linker is fixed. */
if (func_start > exidx_region)
return 0;
}
/* Decode the list of unwinding instructions into a prologue cache.
Note that this may fail due to e.g. a "refuse to unwind" code. */
cache = arm_exidx_fill_cache (this_frame, entry);
if (!cache)
return 0;
*this_prologue_cache = cache;
return 1;
}
struct frame_unwind arm_exidx_unwind = {
NORMAL_FRAME,
gdb/ * frame.c (frame_unwind_register): Throw an error if unwinding the register failed. * get_prev_frame_1 (get_prev_frame_1): Ask the unwinder if there's an unwind stop reason. (frame_stop_reason_string): Handle UNWIND_UNAVAILABLE. * frame.h (enum unwind_stop_reason) <UNWIND_OUTERMOST, UNWIND_UNAVAILABLE>: New. * inline-frame.c (inline_frame_unwind): Install default_frame_unwind_stop_reason. * frame-unwind.c: Include "exceptions.h". (frame_unwind_find_by_frame): Swallow NOT_AVAILABLE_ERROR errors. (default_frame_unwind_stop_reason): New. * frame-unwind.h (frame_unwind_stop_reason_ftype): New typedef. (default_frame_unwind_stop_reason): Declare. (struct frame_unwind) <stop_reason>: New function pointer. * dummy-frame.c: Install default_frame_unwind_stop_reason. * dwarf2-frame.c: Include exceptions.h. (struct dwarf2_frame_cache) <unavailable_retaddr>: New field. (dwarf2_frame_cache): Swallow NOT_AVAILABLE_ERROR errors when computing the CFA. If such an error was thrown, set unavailable_retaddr. (dwarf2_frame_unwind_stop_reason): New. (dwarf2_frame_this_id): Don't build a frame id if the CFA was unavailable. (dwarf2_frame_unwind): Install dwarf2_frame_unwind_stop_reason. (dwarf2_signal_frame_unwind): Ditto. * amd64-tdep.c: Include "exceptions.h". (struct amd64_frame_cache): New field "base_p". (amd64_init_frame_cache): Clear it. (amd64_frame_cache_1): New, factored out from amd64_frame_cache. Avoid reading registers with functions that throw if the register is not necessary to compute the frame base. (amd64_frame_cache): Reimplement wrapping amd64_frame_cache_1, and swallowing NOT_AVAILABLE_ERROR. (amd64_frame_unwind_stop_reason): New. (amd64_frame_this_id): Don't build a frame id if the frame base was unavailable. (amd64_frame_unwind): Install amd64_frame_unwind_stop_reason. (amd64_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (amd64_sigtramp_frame_unwind_stop_reason): New. (amd64_sigtramp_frame_this_id): Don't build a frame id if the frame base was unavailable. (amd64_sigtramp_frame_unwind): Install amd64_sigtramp_frame_unwind_stop_reason. (amd64_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (amd64_epilogue_frame_unwind_stop_reason): New. (amd64_epilogue_frame_this_id): Don't build a frame id if the frame base was unavailable. (amd64_epilogue_frame_unwind): Install amd64_epilogue_frame_unwind_stop_reason. * i386-tdep.c: Include "exceptions.h". (struct i386_frame_cache): New field "base_p". (i386_init_frame_cache): Clear it. (i386_frame_cache_1): New, factored out from amd64_frame_cache. Avoid reading registers with functions that throw if the register is not necessary to compute the frame base. (i386_frame_cache): Reimplement wrapping amd64_frame_cache_1, and swallowing NOT_AVAILABLE_ERROR. (i386_frame_unwind_stop_reason): New. (i386_frame_this_id): Don't build a frame id if the frame base was unavailable. (i386_frame_prev_register): Handle unavailable SP. (i386_frame_unwind): Install i386_frame_unwind_stop_reason. (i386_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (i386_epilogue_frame_unwind_stop_reason): New. (i386_epilogue_frame_this_id): Don't build a frame id if the frame base was unavailable. (i386_epilogue_frame_unwind): Install i386_epilogue_frame_unwind_stop_reason. (i386_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (i386_sigtramp_frame_unwind_stop_reason): New. (i386_sigtramp_frame_this_id): Don't build a frame id if the frame base was unavailable. (i386_sigtramp_frame_unwind): Install i386_sigtramp_frame_unwind_stop_reason. * sentinel-frame.c (sentinel_frame_prev_register): Use the value type's size, not the register's. (sentinel_frame_unwind): Install default_frame_unwind_stop_reason. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind): Install default_frame_unwind_stop_reason. * alpha-tdep.c (alpha_sigtramp_frame_unwind) (alpha_heuristic_frame_unwind): Ditto. * amd64obsd-tdep.c (amd64obsd_trapframe_unwind): Ditto. * arm-tdep.c (arm_prologue_unwind, arm_stub_unwind): Ditto. * avr-tdep.c (avr_frame_unwind): Ditto. * cris-tdep.c (cris_sigtramp_frame_unwind, cris_frame_unwind): Ditto. * frv-linux-tdep.c (frv_linux_sigtramp_frame_unwind): Ditto. * frv-tdep.c (frv_frame_unwind): Ditto. * h8300-tdep.c (h8300_frame_unwind): Ditto. * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind): Ditto. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind): Ditto. * hppa-tdep.c (hppa_frame_unwind, hppa_fallback_frame_unwind) (hppa_stub_frame_unwind): Ditto. * i386obsd-tdep.c (i386obsd_trapframe_unwind): Ditto. * ia64-tdep.c (ia64_frame_unwind, ia64_sigtramp_frame_unwind) (ia64_libunwind_frame_unwind) (ia64_libunwind_sigtramp_frame_unwind): Ditto. * iq2000-tdep.c (iq2000_frame_unwind): Ditto. * lm32-tdep.c (lm32_frame_unwind): Ditto. * m32c-tdep.c (m32c_unwind): Ditto. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_unwind): Ditto. * m32r-tdep.c (m32r_frame_unwind): Ditto. * m68hc11-tdep.c (m68hc11_frame_unwind): Ditto. * m68k-tdep.c (m68k_frame_unwind): Ditto. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_unwind): Ditto. * m88k-tdep.c (m88k_frame_unwind): Ditto. * mep-tdep.c (mep_frame_unwind): Ditto. * microblaze-tdep.c (microblaze_frame_unwind): Ditto. * mips-tdep.c (mips_insn16_frame_unwind, mips_insn32_frame_unwind) (mips_stub_frame_unwind): Ditto. * mn10300-tdep.c (mn10300_frame_unwind): Ditto. * moxie-tdep.c (moxie_frame_unwind): Ditto. * mt-tdep.c (mt_frame_unwind): Ditto. * ppc-linux-tdep.c (ppu2spu_unwind): Ditto. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_unwind): Ditto. * rs6000-tdep.c (rs6000_frame_unwind): Ditto. * s390-tdep.c (s390_frame_unwind, s390_stub_frame_unwind) (s390_sigtramp_frame_unwind): Ditto. * score-tdep.c (score_prologue_unwind): Ditto. * sh-tdep.c (sh_frame_unwind): Ditto. * sh64-tdep.c (sh64_frame_unwind): Ditto. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_unwind): Ditto. * sparc-tdep.c (sparc32_frame_unwind): Ditto. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_unwind): Ditto. * sparc64-tdep.c (sparc64_frame_unwind): Ditto. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_unwind): Ditto. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_unwind): Ditto. * sparc64obsd-tdep.c (sparc64obsd_frame_unwind) (sparc64obsd_trapframe_unwind): Ditto. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_unwind): Ditto. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_unwind): Ditto. * spu-tdep.c (spu_frame_unwind, spu2ppu_unwind): Ditto. * v850-tdep.c (v850_frame_unwind): Ditto. * vax-tdep.c (vax_frame_unwind): Ditto. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_unwind): Ditto. * xstormy16-tdep.c (frame_unwind xstormy16_frame_unwind): Ditto. * xtensa-tdep.c (xtensa_unwind): Ditto.
2011-03-18 19:52:32 +01:00
default_frame_unwind_stop_reason,
arm_prologue_this_id,
arm_prologue_prev_register,
NULL,
arm_exidx_unwind_sniffer
};
Add arm epilogue unwinder Nowadays, GDB can't unwind successfully from epilogue on arm, (gdb) bt #0 0x76ff65a2 in shr1 () from /home/yao/Source/gnu/build/gdb/testsuite/gdb.reverse/shr1.sl #1 0x0000869e in main () at /home/yao/Source/gnu/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c:34 Backtrace stopped: previous frame inner to this frame (corrupt stack?) (gdb) disassemble shr1 Dump of assembler code for function shr1: .... 0x76ff659a <+10>: adds r7, #12 0x76ff659c <+12>: mov sp, r7 0x76ff659e <+14>: ldr.w r7, [sp], #4 0x76ff65a2 <+18>: bx lr End of assembler dump. in this case, prologue unwinder is used. It analyzes the prologue and get the offsets of saved registers to SP. However, in epilogue, the SP has been restored, prologue unwinder gets the registers from the wrong address, and even the frame id is wrong. In reverse debugging, this case (program stops at the last instruction of function) happens quite frequently due to the reverse execution. There are many test fails due to missing epilogue unwinder. This adds epilogue unwinder, but the frame cache is still get by prologue unwinder except that SP is fixed up separately, because SP is restored in epilogue. This patch fixes many fails in solib-precsave.exp, and solib-reverse.exp. gdb: 2016-03-30 Yao Qi <yao.qi@linaro.org> * arm-tdep.c: (arm_make_epilogue_frame_cache): New function. (arm_epilogue_frame_this_id): New function. (arm_epilogue_frame_prev_register): New function. (arm_epilogue_frame_sniffer): New function. (arm_epilogue_frame_unwind): New. (arm_gdbarch_init): Append unwinder arm_epilogue_frame_unwind.
2016-03-30 17:44:24 +02:00
static struct arm_prologue_cache *
arm_make_epilogue_frame_cache (struct frame_info *this_frame)
{
struct arm_prologue_cache *cache;
int reg;
cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
/* Still rely on the offset calculated from prologue. */
arm_scan_prologue (this_frame, cache);
/* Since we are in epilogue, the SP has been restored. */
cache->prev_sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
if (trad_frame_addr_p (cache->saved_regs, reg))
cache->saved_regs[reg].addr += cache->prev_sp;
return cache;
}
/* Implementation of function hook 'this_id' in
'struct frame_uwnind' for epilogue unwinder. */
static void
arm_epilogue_frame_this_id (struct frame_info *this_frame,
void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
CORE_ADDR pc, func;
if (*this_cache == NULL)
*this_cache = arm_make_epilogue_frame_cache (this_frame);
cache = (struct arm_prologue_cache *) *this_cache;
/* Use function start address as part of the frame ID. If we cannot
identify the start address (due to missing symbol information),
fall back to just using the current PC. */
pc = get_frame_pc (this_frame);
func = get_frame_func (this_frame);
if (func == 0)
Add arm epilogue unwinder Nowadays, GDB can't unwind successfully from epilogue on arm, (gdb) bt #0 0x76ff65a2 in shr1 () from /home/yao/Source/gnu/build/gdb/testsuite/gdb.reverse/shr1.sl #1 0x0000869e in main () at /home/yao/Source/gnu/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c:34 Backtrace stopped: previous frame inner to this frame (corrupt stack?) (gdb) disassemble shr1 Dump of assembler code for function shr1: .... 0x76ff659a <+10>: adds r7, #12 0x76ff659c <+12>: mov sp, r7 0x76ff659e <+14>: ldr.w r7, [sp], #4 0x76ff65a2 <+18>: bx lr End of assembler dump. in this case, prologue unwinder is used. It analyzes the prologue and get the offsets of saved registers to SP. However, in epilogue, the SP has been restored, prologue unwinder gets the registers from the wrong address, and even the frame id is wrong. In reverse debugging, this case (program stops at the last instruction of function) happens quite frequently due to the reverse execution. There are many test fails due to missing epilogue unwinder. This adds epilogue unwinder, but the frame cache is still get by prologue unwinder except that SP is fixed up separately, because SP is restored in epilogue. This patch fixes many fails in solib-precsave.exp, and solib-reverse.exp. gdb: 2016-03-30 Yao Qi <yao.qi@linaro.org> * arm-tdep.c: (arm_make_epilogue_frame_cache): New function. (arm_epilogue_frame_this_id): New function. (arm_epilogue_frame_prev_register): New function. (arm_epilogue_frame_sniffer): New function. (arm_epilogue_frame_unwind): New. (arm_gdbarch_init): Append unwinder arm_epilogue_frame_unwind.
2016-03-30 17:44:24 +02:00
func = pc;
(*this_id) = frame_id_build (cache->prev_sp, pc);
}
/* Implementation of function hook 'prev_register' in
'struct frame_uwnind' for epilogue unwinder. */
static struct value *
arm_epilogue_frame_prev_register (struct frame_info *this_frame,
void **this_cache, int regnum)
{
if (*this_cache == NULL)
*this_cache = arm_make_epilogue_frame_cache (this_frame);
return arm_prologue_prev_register (this_frame, this_cache, regnum);
}
static int arm_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch,
CORE_ADDR pc);
static int thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch,
CORE_ADDR pc);
/* Implementation of function hook 'sniffer' in
'struct frame_uwnind' for epilogue unwinder. */
static int
arm_epilogue_frame_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_prologue_cache)
{
if (frame_relative_level (this_frame) == 0)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
CORE_ADDR pc = get_frame_pc (this_frame);
if (arm_frame_is_thumb (this_frame))
return thumb_stack_frame_destroyed_p (gdbarch, pc);
else
return arm_stack_frame_destroyed_p_1 (gdbarch, pc);
}
else
return 0;
}
/* Frame unwinder from epilogue. */
static const struct frame_unwind arm_epilogue_frame_unwind =
{
NORMAL_FRAME,
default_frame_unwind_stop_reason,
arm_epilogue_frame_this_id,
arm_epilogue_frame_prev_register,
NULL,
arm_epilogue_frame_sniffer,
};
/* Recognize GCC's trampoline for thumb call-indirect. If we are in a
trampoline, return the target PC. Otherwise return 0.
void call0a (char c, short s, int i, long l) {}
int main (void)
{
(*pointer_to_call0a) (c, s, i, l);
}
Instead of calling a stub library function _call_via_xx (xx is
the register name), GCC may inline the trampoline in the object
file as below (register r2 has the address of call0a).
.global main
.type main, %function
...
bl .L1
...
.size main, .-main
.L1:
bx r2
The trampoline 'bx r2' doesn't belong to main. */
static CORE_ADDR
arm_skip_bx_reg (struct frame_info *frame, CORE_ADDR pc)
{
/* The heuristics of recognizing such trampoline is that FRAME is
executing in Thumb mode and the instruction on PC is 'bx Rm'. */
if (arm_frame_is_thumb (frame))
{
gdb_byte buf[2];
if (target_read_memory (pc, buf, 2) == 0)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order_for_code
= gdbarch_byte_order_for_code (gdbarch);
uint16_t insn
= extract_unsigned_integer (buf, 2, byte_order_for_code);
if ((insn & 0xff80) == 0x4700) /* bx <Rm> */
{
CORE_ADDR dest
= get_frame_register_unsigned (frame, bits (insn, 3, 6));
/* Clear the LSB so that gdb core sets step-resume
breakpoint at the right address. */
return UNMAKE_THUMB_ADDR (dest);
}
}
}
return 0;
}
static struct arm_prologue_cache *
arm_make_stub_cache (struct frame_info *this_frame)
{
struct arm_prologue_cache *cache;
cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
cache->prev_sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM);
return cache;
}
/* Our frame ID for a stub frame is the current SP and LR. */
static void
arm_stub_this_id (struct frame_info *this_frame,
void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
if (*this_cache == NULL)
*this_cache = arm_make_stub_cache (this_frame);
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
cache = (struct arm_prologue_cache *) *this_cache;
*this_id = frame_id_build (cache->prev_sp, get_frame_pc (this_frame));
}
static int
arm_stub_unwind_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_prologue_cache)
{
CORE_ADDR addr_in_block;
-Wpointer-sign: char -> gdb_byte. -Wpointer-sign catches all these cases across the codebase that should be using gdb_byte for raw target bytes. I think these are all obvious, hence I've collapsed into a single patch. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * aarch64-tdep.c (aarch64_default_breakpoint): Change type to gdb_byte[]. (aarch64_breakpoint_from_pc): Change return type to gdb_byte *. * ada-lang.c (ada_value_assign): Use gdb_byte. * alphanbsd-tdep.c (sigtramp_retcode): Change type to gdb_byte[]. (alphanbsd_sigtramp_offset): Use gdb_byte. * arm-linux-tdep.c (arm_linux_arm_le_breakpoint) (arm_linux_arm_be_breakpoint, eabi_linux_arm_le_breakpoint) (eabi_linux_arm_be_breakpoint, arm_linux_thumb_be_breakpoint) (arm_linux_thumb_le_breakpoint, arm_linux_thumb2_be_breakpoint) (arm_linux_thumb2_le_breakpoint): Change type to gdb_byte[]. * arm-tdep.c (arm_stub_unwind_sniffer) (arm_displaced_init_closure): Use gdb_byte. (arm_default_arm_le_breakpoint, arm_default_arm_be_breakpoint) (arm_default_thumb_le_breakpoint) (arm_default_thumb_be_breakpoint): Change type to gdb_byte[]. * arm-tdep.h (struct gdbarch_tdep) <arm_breakpoint, thumb_breakpoint, thumb2_breakpoint>: Change type to gdb_byte *. * arm-wince-tdep.c (arm_wince_le_breakpoint) (arm_wince_thumb_le_breakpoint): Change type to gdb_byte[]. * armnbsd-tdep.c (arm_nbsd_arm_le_breakpoint) (arm_nbsd_arm_be_breakpoint, arm_nbsd_thumb_le_breakpoint) (arm_nbsd_thumb_be_breakpoint): Change type to gdb_byte[]. * armobsd-tdep.c (arm_obsd_thumb_le_breakpoint) (arm_obsd_thumb_be_breakpoint): Change type to gdb_byte[]. * cris-tdep.c (push_stack_item, cris_push_dummy_call) (cris_store_return_value, cris_extract_return_value): Use gdb_byte. (constraint): Change type of parameter to char * from signed char*. Use gdb_byte. * dwarf2loc.c (read_pieced_value, write_pieced_value): Change type of local buffer to gdb_byte *. * dwarf2read.c (read_index_from_section): Use gdb_byte. (create_dwp_hash_table): Change type of locals to gdb_byte *. (add_address_entry): Change type of local buffer to gdb_byte[]. * frv-tdep.c (frv_adjust_breakpoint_address, find_func_descr) (frv_push_dummy_call): Use gdb_byte. * hppa-hpux-tdep.c (hppa_hpux_push_dummy_code) (hppa_hpux_supply_ss_fpblock, hppa_hpux_supply_ss_wide) (hppa_hpux_supply_save_state): Use gdb_byte. * hppa-tdep.c (hppa32_push_dummy_call) (hppa64_convert_code_addr_to_fptr): Use gdb_byte. * ia64-tdep.c (extract_bit_field, replace_bit_field) (slotN_contents, replace_slotN_contents): Change type of parameter to gdb_byte *. (fetch_instruction, ia64_pseudo_register_write) (ia64_register_to_value, ia64_value_to_register) (ia64_extract_return_value, ia64_store_return_value) (ia64_push_dummy_call): Use gdb_byte. * m32c-tdep.c (m32c_return_value): Remove cast. * m68hc11-tdep.c (m68hc11_pseudo_register_write) (m68hc11_push_dummy_call, m68hc11_store_return_value): Use gdb_byte. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use gdb_byte. * mn10300-tdep.c (mn10300_store_return_value) (mn10300_breakpoint_from_pc, mn10300_push_dummy_call): Use gdb_byte. * moxie-tdep.c (moxie_process_readu): Use gdb_byte. (moxie_process_record): Remove casts. * ppc-ravenscar-thread.c (supply_register_at_address) (ppc_ravenscar_generic_store_registers): Use gdb_byte. * ravenscar-thread.c (get_running_thread_id): Use gdb_byte. * remote-m32r-sdi.c (m32r_fetch_register): Use gdb_byte. * remote-mips.c (mips_xfer_memory): Use gdb_byte. * remote.c (compare_sections_command): Use gdb_byte. * score-tdep.c (score7_free_memblock): Change type of parameter to gdb_byte *. * sh-tdep.c (sh_justify_value_in_reg): Change return type to gdb_byte *. Use gdb_byte. (sh_push_dummy_call_fpu): Use gdb_byte. (sh_extract_return_value_nofpu, sh_extract_return_value_fpu) (sh_store_return_value_nofpu, sh_store_return_value_fpu) (sh_register_convert_to_virtual, sh_register_convert_to_raw): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh_pseudo_register_read, sh_pseudo_register_write): Use gdb_byte. * sh64-tdep.c (sh64_push_dummy_call): Use gdb_byte. (sh64_store_return_value, sh64_register_convert_to_virtual): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh64_pseudo_register_write): Use gdb_byte. * solib-darwin.c (darwin_current_sos): Add casts to 'gdb_byte *'. * solib-irix.c (fetch_lm_info): Likewise. Use gdb_byte for byte buffer. (irix_current_sos): Use gdb_byte. * solib-som.c (som_current_sos): Use gdb_byte. * sparc-ravenscar-thread.c (supply_register_at_address) (sparc_ravenscar_generic_store_registers): Use gdb_byte. * spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'. * spu-tdep.c (spu_get_overlay_table): Use gdb_byte. * tic6x-tdep.c (tic6x_breakpoint_from_pc): Change return type to 'gdb_byte *'. * tic6x-tdep.h (struct gdbarch_tdep) <breakpoint>: Change type to 'gdb_byte *'. * tracepoint.c (tfile_fetch_registers): Use gdb_byte. * xstormy16-tdep.c (xstormy16_extract_return_value) (xstormy16_store_return_value): Change parameter type to 'gdb_byte *'. Adjust. (xstormy16_push_dummy_call): Use gdb_byte. * xtensa-tdep.c (xtensa_scan_prologue, call0_ret) (call0_analyze_prologue, execute_code): Use gdb_byte.
2013-04-19 17:09:46 +02:00
gdb_byte dummy[4];
CORE_ADDR pc, start_addr;
const char *name;
addr_in_block = get_frame_address_in_block (this_frame);
pc = get_frame_pc (this_frame);
* objfiles.h (pc_in_section): New prototype. (in_plt_section): Remove name argument, replace prototype with static inline function. * mips-tdep.h: Include "objfiles.h". (in_mips_stubs_section): New function. * hppa-tdep.h (gdbarch_tdep): Remove name argument of in_solib_call_trampoline member. (hppa_in_solib_call_trampoline): Remove name argument. * objfiles.c (pc_in_section): New function. (in_plt_section): Remove function. * mips-linux-tdep.c: Include "objfiles.h". (mips_linux_in_dynsym_stub): Call in_mips_stubs_section. Remove name argument. Return 1 rather than the low 16-bit halfword of any instruction examined. (mips_linux_in_dynsym_resolve_code): Update mips_linux_in_dynsym_stub call accordingly. * mips-tdep.c (mips_stub_frame_sniffer): Use in_mips_stubs_section rather than an equivalent hand-coded sequence. * hppa-hpux-tdep.c (in_opd_section): Remove function. (hppa32_hpux_in_solib_call_trampoline): Remove name argument. (hppa64_hpux_in_solib_call_trampoline): Likewise. (hppa64_hpux_find_global_pointer): Use pc_in_section rather than in_opd_section. * hppa-tdep.c (hppa_stub_unwind_sniffer): Remove name argument on call to tdep->in_solib_call_trampoline. (hppa_in_solib_call_trampoline): Remove name argument, update according to in_plt_section change. (hppa_skip_trampoline_code): Update according to in_plt_section change. * aarch64-tdep.c (aarch64_stub_unwind_sniffer): Likewise. * arm-symbian-tdep.c (arm_symbian_skip_trampoline_code): Likewise. * arm-tdep.c (arm_stub_unwind_sniffer): Likewise. * hppa-linux-tdep.c (hppa_linux_find_global_pointer): Likewise. * hppabsd-tdep.c (hppabsd_find_global_pointer): Likewise. * nios2-tdep.c (nios2_stub_frame_sniffer): Likewise. * nto-tdep.c (nto_relocate_section_addresses): Likewise. * s390-tdep.c (s390_stub_frame_sniffer): Likewise. * sh-tdep.c (sh_stub_unwind_sniffer): Likewise. * solib-dsbt.c (dsbt_in_dynsym_resolve_code): Likewise. * solib-frv.c (frv_in_dynsym_resolve_code): Likewise. * solib-svr4.c (svr4_in_dynsym_resolve_code): Likewise. * solib-target.c (solib_target_in_dynsym_resolve_code): Likewise. * sparc-tdep.c (sparc_analyze_prologue): Likewise. * tic6x-tdep.c (tic6x_stub_unwind_sniffer): Likewise.
2013-06-25 00:18:32 +02:00
if (in_plt_section (addr_in_block)
/* We also use the stub winder if the target memory is unreadable
to avoid having the prologue unwinder trying to read it. */
|| target_read_memory (pc, dummy, 4) != 0)
return 1;
if (find_pc_partial_function (pc, &name, &start_addr, NULL) == 0
&& arm_skip_bx_reg (this_frame, pc) != 0)
return 1;
return 0;
}
struct frame_unwind arm_stub_unwind = {
NORMAL_FRAME,
gdb/ * frame.c (frame_unwind_register): Throw an error if unwinding the register failed. * get_prev_frame_1 (get_prev_frame_1): Ask the unwinder if there's an unwind stop reason. (frame_stop_reason_string): Handle UNWIND_UNAVAILABLE. * frame.h (enum unwind_stop_reason) <UNWIND_OUTERMOST, UNWIND_UNAVAILABLE>: New. * inline-frame.c (inline_frame_unwind): Install default_frame_unwind_stop_reason. * frame-unwind.c: Include "exceptions.h". (frame_unwind_find_by_frame): Swallow NOT_AVAILABLE_ERROR errors. (default_frame_unwind_stop_reason): New. * frame-unwind.h (frame_unwind_stop_reason_ftype): New typedef. (default_frame_unwind_stop_reason): Declare. (struct frame_unwind) <stop_reason>: New function pointer. * dummy-frame.c: Install default_frame_unwind_stop_reason. * dwarf2-frame.c: Include exceptions.h. (struct dwarf2_frame_cache) <unavailable_retaddr>: New field. (dwarf2_frame_cache): Swallow NOT_AVAILABLE_ERROR errors when computing the CFA. If such an error was thrown, set unavailable_retaddr. (dwarf2_frame_unwind_stop_reason): New. (dwarf2_frame_this_id): Don't build a frame id if the CFA was unavailable. (dwarf2_frame_unwind): Install dwarf2_frame_unwind_stop_reason. (dwarf2_signal_frame_unwind): Ditto. * amd64-tdep.c: Include "exceptions.h". (struct amd64_frame_cache): New field "base_p". (amd64_init_frame_cache): Clear it. (amd64_frame_cache_1): New, factored out from amd64_frame_cache. Avoid reading registers with functions that throw if the register is not necessary to compute the frame base. (amd64_frame_cache): Reimplement wrapping amd64_frame_cache_1, and swallowing NOT_AVAILABLE_ERROR. (amd64_frame_unwind_stop_reason): New. (amd64_frame_this_id): Don't build a frame id if the frame base was unavailable. (amd64_frame_unwind): Install amd64_frame_unwind_stop_reason. (amd64_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (amd64_sigtramp_frame_unwind_stop_reason): New. (amd64_sigtramp_frame_this_id): Don't build a frame id if the frame base was unavailable. (amd64_sigtramp_frame_unwind): Install amd64_sigtramp_frame_unwind_stop_reason. (amd64_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (amd64_epilogue_frame_unwind_stop_reason): New. (amd64_epilogue_frame_this_id): Don't build a frame id if the frame base was unavailable. (amd64_epilogue_frame_unwind): Install amd64_epilogue_frame_unwind_stop_reason. * i386-tdep.c: Include "exceptions.h". (struct i386_frame_cache): New field "base_p". (i386_init_frame_cache): Clear it. (i386_frame_cache_1): New, factored out from amd64_frame_cache. Avoid reading registers with functions that throw if the register is not necessary to compute the frame base. (i386_frame_cache): Reimplement wrapping amd64_frame_cache_1, and swallowing NOT_AVAILABLE_ERROR. (i386_frame_unwind_stop_reason): New. (i386_frame_this_id): Don't build a frame id if the frame base was unavailable. (i386_frame_prev_register): Handle unavailable SP. (i386_frame_unwind): Install i386_frame_unwind_stop_reason. (i386_epilogue_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (i386_epilogue_frame_unwind_stop_reason): New. (i386_epilogue_frame_this_id): Don't build a frame id if the frame base was unavailable. (i386_epilogue_frame_unwind): Install i386_epilogue_frame_unwind_stop_reason. (i386_sigtramp_frame_cache): Swallow NOT_AVAILABLE_ERROR, and set base_p if the frame base was computable. (i386_sigtramp_frame_unwind_stop_reason): New. (i386_sigtramp_frame_this_id): Don't build a frame id if the frame base was unavailable. (i386_sigtramp_frame_unwind): Install i386_sigtramp_frame_unwind_stop_reason. * sentinel-frame.c (sentinel_frame_prev_register): Use the value type's size, not the register's. (sentinel_frame_unwind): Install default_frame_unwind_stop_reason. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind): Install default_frame_unwind_stop_reason. * alpha-tdep.c (alpha_sigtramp_frame_unwind) (alpha_heuristic_frame_unwind): Ditto. * amd64obsd-tdep.c (amd64obsd_trapframe_unwind): Ditto. * arm-tdep.c (arm_prologue_unwind, arm_stub_unwind): Ditto. * avr-tdep.c (avr_frame_unwind): Ditto. * cris-tdep.c (cris_sigtramp_frame_unwind, cris_frame_unwind): Ditto. * frv-linux-tdep.c (frv_linux_sigtramp_frame_unwind): Ditto. * frv-tdep.c (frv_frame_unwind): Ditto. * h8300-tdep.c (h8300_frame_unwind): Ditto. * hppa-hpux-tdep.c (hppa_hpux_sigtramp_frame_unwind): Ditto. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind): Ditto. * hppa-tdep.c (hppa_frame_unwind, hppa_fallback_frame_unwind) (hppa_stub_frame_unwind): Ditto. * i386obsd-tdep.c (i386obsd_trapframe_unwind): Ditto. * ia64-tdep.c (ia64_frame_unwind, ia64_sigtramp_frame_unwind) (ia64_libunwind_frame_unwind) (ia64_libunwind_sigtramp_frame_unwind): Ditto. * iq2000-tdep.c (iq2000_frame_unwind): Ditto. * lm32-tdep.c (lm32_frame_unwind): Ditto. * m32c-tdep.c (m32c_unwind): Ditto. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_unwind): Ditto. * m32r-tdep.c (m32r_frame_unwind): Ditto. * m68hc11-tdep.c (m68hc11_frame_unwind): Ditto. * m68k-tdep.c (m68k_frame_unwind): Ditto. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_unwind): Ditto. * m88k-tdep.c (m88k_frame_unwind): Ditto. * mep-tdep.c (mep_frame_unwind): Ditto. * microblaze-tdep.c (microblaze_frame_unwind): Ditto. * mips-tdep.c (mips_insn16_frame_unwind, mips_insn32_frame_unwind) (mips_stub_frame_unwind): Ditto. * mn10300-tdep.c (mn10300_frame_unwind): Ditto. * moxie-tdep.c (moxie_frame_unwind): Ditto. * mt-tdep.c (mt_frame_unwind): Ditto. * ppc-linux-tdep.c (ppu2spu_unwind): Ditto. * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_unwind): Ditto. * rs6000-tdep.c (rs6000_frame_unwind): Ditto. * s390-tdep.c (s390_frame_unwind, s390_stub_frame_unwind) (s390_sigtramp_frame_unwind): Ditto. * score-tdep.c (score_prologue_unwind): Ditto. * sh-tdep.c (sh_frame_unwind): Ditto. * sh64-tdep.c (sh64_frame_unwind): Ditto. * sparc-sol2-tdep.c (sparc32_sol2_sigtramp_frame_unwind): Ditto. * sparc-tdep.c (sparc32_frame_unwind): Ditto. * sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_unwind): Ditto. * sparc64-tdep.c (sparc64_frame_unwind): Ditto. * sparc64fbsd-tdep.c (sparc64fbsd_sigtramp_frame_unwind): Ditto. * sparc64nbsd-tdep.c (sparc64nbsd_sigcontext_frame_unwind): Ditto. * sparc64obsd-tdep.c (sparc64obsd_frame_unwind) (sparc64obsd_trapframe_unwind): Ditto. * sparcnbsd-tdep.c (sparc32nbsd_sigcontext_frame_unwind): Ditto. * sparcobsd-tdep.c (sparc32obsd_sigtramp_frame_unwind): Ditto. * spu-tdep.c (spu_frame_unwind, spu2ppu_unwind): Ditto. * v850-tdep.c (v850_frame_unwind): Ditto. * vax-tdep.c (vax_frame_unwind): Ditto. * vaxobsd-tdep.c (vaxobsd_sigtramp_frame_unwind): Ditto. * xstormy16-tdep.c (frame_unwind xstormy16_frame_unwind): Ditto. * xtensa-tdep.c (xtensa_unwind): Ditto.
2011-03-18 19:52:32 +01:00
default_frame_unwind_stop_reason,
arm_stub_this_id,
arm_prologue_prev_register,
NULL,
arm_stub_unwind_sniffer
};
/* Put here the code to store, into CACHE->saved_regs, the addresses
of the saved registers of frame described by THIS_FRAME. CACHE is
returned. */
static struct arm_prologue_cache *
arm_m_exception_cache (struct frame_info *this_frame)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct arm_prologue_cache *cache;
CORE_ADDR unwound_sp;
LONGEST xpsr;
cache = FRAME_OBSTACK_ZALLOC (struct arm_prologue_cache);
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
unwound_sp = get_frame_register_unsigned (this_frame,
ARM_SP_REGNUM);
/* The hardware saves eight 32-bit words, comprising xPSR,
ReturnAddress, LR (R14), R12, R3, R2, R1, R0. See details in
"B1.5.6 Exception entry behavior" in
"ARMv7-M Architecture Reference Manual". */
cache->saved_regs[0].addr = unwound_sp;
cache->saved_regs[1].addr = unwound_sp + 4;
cache->saved_regs[2].addr = unwound_sp + 8;
cache->saved_regs[3].addr = unwound_sp + 12;
cache->saved_regs[12].addr = unwound_sp + 16;
cache->saved_regs[14].addr = unwound_sp + 20;
cache->saved_regs[15].addr = unwound_sp + 24;
cache->saved_regs[ARM_PS_REGNUM].addr = unwound_sp + 28;
/* If bit 9 of the saved xPSR is set, then there is a four-byte
aligner between the top of the 32-byte stack frame and the
previous context's stack pointer. */
cache->prev_sp = unwound_sp + 32;
if (safe_read_memory_integer (unwound_sp + 28, 4, byte_order, &xpsr)
&& (xpsr & (1 << 9)) != 0)
cache->prev_sp += 4;
return cache;
}
/* Implementation of function hook 'this_id' in
'struct frame_uwnind'. */
static void
arm_m_exception_this_id (struct frame_info *this_frame,
void **this_cache,
struct frame_id *this_id)
{
struct arm_prologue_cache *cache;
if (*this_cache == NULL)
*this_cache = arm_m_exception_cache (this_frame);
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
cache = (struct arm_prologue_cache *) *this_cache;
/* Our frame ID for a stub frame is the current SP and LR. */
*this_id = frame_id_build (cache->prev_sp,
get_frame_pc (this_frame));
}
/* Implementation of function hook 'prev_register' in
'struct frame_uwnind'. */
static struct value *
arm_m_exception_prev_register (struct frame_info *this_frame,
void **this_cache,
int prev_regnum)
{
struct arm_prologue_cache *cache;
if (*this_cache == NULL)
*this_cache = arm_m_exception_cache (this_frame);
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
cache = (struct arm_prologue_cache *) *this_cache;
/* The value was already reconstructed into PREV_SP. */
if (prev_regnum == ARM_SP_REGNUM)
return frame_unwind_got_constant (this_frame, prev_regnum,
cache->prev_sp);
return trad_frame_get_prev_register (this_frame, cache->saved_regs,
prev_regnum);
}
/* Implementation of function hook 'sniffer' in
'struct frame_uwnind'. */
static int
arm_m_exception_unwind_sniffer (const struct frame_unwind *self,
struct frame_info *this_frame,
void **this_prologue_cache)
{
CORE_ADDR this_pc = get_frame_pc (this_frame);
/* No need to check is_m; this sniffer is only registered for
M-profile architectures. */
/* Check if exception frame returns to a magic PC value. */
return arm_m_addr_is_magic (this_pc);
}
/* Frame unwinder for M-profile exceptions. */
struct frame_unwind arm_m_exception_unwind =
{
SIGTRAMP_FRAME,
default_frame_unwind_stop_reason,
arm_m_exception_this_id,
arm_m_exception_prev_register,
NULL,
arm_m_exception_unwind_sniffer
};
static CORE_ADDR
arm_normal_frame_base (struct frame_info *this_frame, void **this_cache)
{
struct arm_prologue_cache *cache;
if (*this_cache == NULL)
*this_cache = arm_make_prologue_cache (this_frame);
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
cache = (struct arm_prologue_cache *) *this_cache;
return cache->prev_sp - cache->framesize;
}
struct frame_base arm_normal_base = {
&arm_prologue_unwind,
arm_normal_frame_base,
arm_normal_frame_base,
arm_normal_frame_base
};
static struct value *
arm_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
int regnum)
{
struct gdbarch * gdbarch = get_frame_arch (this_frame);
CORE_ADDR lr, cpsr;
ULONGEST t_bit = arm_psr_thumb_bit (gdbarch);
switch (regnum)
{
case ARM_PC_REGNUM:
/* The PC is normally copied from the return column, which
describes saves of LR. However, that version may have an
extra bit set to indicate Thumb state. The bit is not
part of the PC. */
lr = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM);
return frame_unwind_got_constant (this_frame, regnum,
arm_addr_bits_remove (gdbarch, lr));
case ARM_PS_REGNUM:
/* Reconstruct the T bit; see arm_prologue_prev_register for details. */
2008-05-01 20:32:52 +02:00
cpsr = get_frame_register_unsigned (this_frame, regnum);
lr = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM);
if (IS_THUMB_ADDR (lr))
cpsr |= t_bit;
else
cpsr &= ~t_bit;
2008-05-01 20:32:52 +02:00
return frame_unwind_got_constant (this_frame, regnum, cpsr);
default:
internal_error (__FILE__, __LINE__,
_("Unexpected register %d"), regnum);
}
}
static void
arm_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
struct dwarf2_frame_state_reg *reg,
struct frame_info *this_frame)
{
switch (regnum)
{
case ARM_PC_REGNUM:
case ARM_PS_REGNUM:
reg->how = DWARF2_FRAME_REG_FN;
reg->loc.fn = arm_dwarf2_prev_register;
break;
case ARM_SP_REGNUM:
reg->how = DWARF2_FRAME_REG_CFA;
break;
}
}
/* Implement the stack_frame_destroyed_p gdbarch method. */
static int
thumb_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned int insn, insn2;
int found_return = 0, found_stack_adjust = 0;
CORE_ADDR func_start, func_end;
CORE_ADDR scan_pc;
gdb_byte buf[4];
if (!find_pc_partial_function (pc, NULL, &func_start, &func_end))
return 0;
/* The epilogue is a sequence of instructions along the following lines:
- add stack frame size to SP or FP
- [if frame pointer used] restore SP from FP
- restore registers from SP [may include PC]
- a return-type instruction [if PC wasn't already restored]
In a first pass, we scan forward from the current PC and verify the
instructions we find as compatible with this sequence, ending in a
return instruction.
However, this is not sufficient to distinguish indirect function calls
within a function from indirect tail calls in the epilogue in some cases.
Therefore, if we didn't already find any SP-changing instruction during
forward scan, we add a backward scanning heuristic to ensure we actually
are in the epilogue. */
scan_pc = pc;
while (scan_pc < func_end && !found_return)
{
if (target_read_memory (scan_pc, buf, 2))
break;
scan_pc += 2;
insn = extract_unsigned_integer (buf, 2, byte_order_for_code);
if ((insn & 0xff80) == 0x4700) /* bx <Rm> */
found_return = 1;
else if (insn == 0x46f7) /* mov pc, lr */
found_return = 1;
else if (thumb_instruction_restores_sp (insn))
{
if ((insn & 0xff00) == 0xbd00) /* pop <registers, PC> */
found_return = 1;
}
else if (thumb_insn_size (insn) == 4) /* 32-bit Thumb-2 instruction */
{
if (target_read_memory (scan_pc, buf, 2))
break;
scan_pc += 2;
insn2 = extract_unsigned_integer (buf, 2, byte_order_for_code);
if (insn == 0xe8bd) /* ldm.w sp!, <registers> */
{
if (insn2 & 0x8000) /* <registers> include PC. */
found_return = 1;
}
else if (insn == 0xf85d /* ldr.w <Rt>, [sp], #4 */
&& (insn2 & 0x0fff) == 0x0b04)
{
if ((insn2 & 0xf000) == 0xf000) /* <Rt> is PC. */
found_return = 1;
}
else if ((insn & 0xffbf) == 0xecbd /* vldm sp!, <list> */
&& (insn2 & 0x0e00) == 0x0a00)
arm software watchpoint: return to epilogue Hi, This patch is to handle a software watchpoint case that program returns to caller's epilogue, and it causes the fail in thumb mode, finish^M Run till exit from #0 func () at gdb/testsuite/gdb.base/watchpoint-cond-gone.c:26^M 0x000001f6 in jumper ()^M (gdb) FAIL: gdb.base/watchpoint-cond-gone.exp: Catch the no longer valid watchpoint In the test, jumper calls func, and programs returns from func to jumper's epilogue, IOW, the branch instruction is the last instruction of jumper's function body. jumper: ..... 0x000001f2 <+10>: bl 0x200 [1] <---- indirect call to func 0x000001f6 <+14>: mov sp, r7 [2] <---- start of the epilogue 0x000001f8 <+16>: add sp, #8 0x000001fa <+18>: pop {r7} 0x000001fc <+20>: pop {r0} 0x000001fe <+22>: bx r0 When the inferior returns from func back to jumper, it is expected that an expression of a software watchpoint becomes out-of-scope. GDB validates the expression by checking the corresponding frame, but this check is guarded by gdbarch_in_function_epilogue_p. See breakpoint.c:watchpoint_check. It doesn't work in this case, because program returns from func's epilogue back to jumper's epilogue [2], GDB thinks the program is still within the epilogue, but in fact it goes to a different one. When PC points at [2], the sp-restore instruction is to be executed, so the stack frame isn't destroyed yet and we can still use the frame mechanism reliably. Note that when PC points to the first instruction of restoring SP, it is part of epilogue, but we still return zero. When goes to the next instruction, the backward scan will still match the epilogue sequence correctly. The reason for doing this is to handle the "return-to-epilogue" case. What this patch does is to restrict the epilogue matching that let GDB think the first SP restore instruction isn't part of the epilogue, and fall back to use frame mechanism. We set 'found_stack_adjust' zero before backward scan, and we've done this for arm mode counterpart (arm_in_function_epilogue_p) too. The patch is tested in arm-none-eabi and arm-none-linux-gnueabi with various multilibs. OK to apply? gdb: 2014-08-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (thumb_in_function_epilogue_p): Don't set found_stack_adjust in forward scan. Remove condition check on found_stack_adjust which is always true. Indent the code.
2014-08-01 05:26:16 +02:00
;
else
break;
}
else
break;
}
if (!found_return)
return 0;
/* Since any instruction in the epilogue sequence, with the possible
exception of return itself, updates the stack pointer, we need to
scan backwards for at most one instruction. Try either a 16-bit or
a 32-bit instruction. This is just a heuristic, so we do not worry
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
too much about false positives. */
arm software watchpoint: return to epilogue Hi, This patch is to handle a software watchpoint case that program returns to caller's epilogue, and it causes the fail in thumb mode, finish^M Run till exit from #0 func () at gdb/testsuite/gdb.base/watchpoint-cond-gone.c:26^M 0x000001f6 in jumper ()^M (gdb) FAIL: gdb.base/watchpoint-cond-gone.exp: Catch the no longer valid watchpoint In the test, jumper calls func, and programs returns from func to jumper's epilogue, IOW, the branch instruction is the last instruction of jumper's function body. jumper: ..... 0x000001f2 <+10>: bl 0x200 [1] <---- indirect call to func 0x000001f6 <+14>: mov sp, r7 [2] <---- start of the epilogue 0x000001f8 <+16>: add sp, #8 0x000001fa <+18>: pop {r7} 0x000001fc <+20>: pop {r0} 0x000001fe <+22>: bx r0 When the inferior returns from func back to jumper, it is expected that an expression of a software watchpoint becomes out-of-scope. GDB validates the expression by checking the corresponding frame, but this check is guarded by gdbarch_in_function_epilogue_p. See breakpoint.c:watchpoint_check. It doesn't work in this case, because program returns from func's epilogue back to jumper's epilogue [2], GDB thinks the program is still within the epilogue, but in fact it goes to a different one. When PC points at [2], the sp-restore instruction is to be executed, so the stack frame isn't destroyed yet and we can still use the frame mechanism reliably. Note that when PC points to the first instruction of restoring SP, it is part of epilogue, but we still return zero. When goes to the next instruction, the backward scan will still match the epilogue sequence correctly. The reason for doing this is to handle the "return-to-epilogue" case. What this patch does is to restrict the epilogue matching that let GDB think the first SP restore instruction isn't part of the epilogue, and fall back to use frame mechanism. We set 'found_stack_adjust' zero before backward scan, and we've done this for arm mode counterpart (arm_in_function_epilogue_p) too. The patch is tested in arm-none-eabi and arm-none-linux-gnueabi with various multilibs. OK to apply? gdb: 2014-08-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (thumb_in_function_epilogue_p): Don't set found_stack_adjust in forward scan. Remove condition check on found_stack_adjust which is always true. Indent the code.
2014-08-01 05:26:16 +02:00
if (pc - 4 < func_start)
return 0;
if (target_read_memory (pc - 4, buf, 4))
return 0;
arm software watchpoint: return to epilogue Hi, This patch is to handle a software watchpoint case that program returns to caller's epilogue, and it causes the fail in thumb mode, finish^M Run till exit from #0 func () at gdb/testsuite/gdb.base/watchpoint-cond-gone.c:26^M 0x000001f6 in jumper ()^M (gdb) FAIL: gdb.base/watchpoint-cond-gone.exp: Catch the no longer valid watchpoint In the test, jumper calls func, and programs returns from func to jumper's epilogue, IOW, the branch instruction is the last instruction of jumper's function body. jumper: ..... 0x000001f2 <+10>: bl 0x200 [1] <---- indirect call to func 0x000001f6 <+14>: mov sp, r7 [2] <---- start of the epilogue 0x000001f8 <+16>: add sp, #8 0x000001fa <+18>: pop {r7} 0x000001fc <+20>: pop {r0} 0x000001fe <+22>: bx r0 When the inferior returns from func back to jumper, it is expected that an expression of a software watchpoint becomes out-of-scope. GDB validates the expression by checking the corresponding frame, but this check is guarded by gdbarch_in_function_epilogue_p. See breakpoint.c:watchpoint_check. It doesn't work in this case, because program returns from func's epilogue back to jumper's epilogue [2], GDB thinks the program is still within the epilogue, but in fact it goes to a different one. When PC points at [2], the sp-restore instruction is to be executed, so the stack frame isn't destroyed yet and we can still use the frame mechanism reliably. Note that when PC points to the first instruction of restoring SP, it is part of epilogue, but we still return zero. When goes to the next instruction, the backward scan will still match the epilogue sequence correctly. The reason for doing this is to handle the "return-to-epilogue" case. What this patch does is to restrict the epilogue matching that let GDB think the first SP restore instruction isn't part of the epilogue, and fall back to use frame mechanism. We set 'found_stack_adjust' zero before backward scan, and we've done this for arm mode counterpart (arm_in_function_epilogue_p) too. The patch is tested in arm-none-eabi and arm-none-linux-gnueabi with various multilibs. OK to apply? gdb: 2014-08-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (thumb_in_function_epilogue_p): Don't set found_stack_adjust in forward scan. Remove condition check on found_stack_adjust which is always true. Indent the code.
2014-08-01 05:26:16 +02:00
insn = extract_unsigned_integer (buf, 2, byte_order_for_code);
insn2 = extract_unsigned_integer (buf + 2, 2, byte_order_for_code);
if (thumb_instruction_restores_sp (insn2))
found_stack_adjust = 1;
else if (insn == 0xe8bd) /* ldm.w sp!, <registers> */
found_stack_adjust = 1;
else if (insn == 0xf85d /* ldr.w <Rt>, [sp], #4 */
&& (insn2 & 0x0fff) == 0x0b04)
found_stack_adjust = 1;
else if ((insn & 0xffbf) == 0xecbd /* vldm sp!, <list> */
&& (insn2 & 0x0e00) == 0x0a00)
found_stack_adjust = 1;
return found_stack_adjust;
}
static int
arm_stack_frame_destroyed_p_1 (struct gdbarch *gdbarch, CORE_ADDR pc)
{
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
unsigned int insn;
int found_return;
CORE_ADDR func_start, func_end;
if (!find_pc_partial_function (pc, NULL, &func_start, &func_end))
return 0;
/* We are in the epilogue if the previous instruction was a stack
adjustment and the next instruction is a possible return (bx, mov
pc, or pop). We could have to scan backwards to find the stack
adjustment, or forwards to find the return, but this is a decent
approximation. First scan forwards. */
found_return = 0;
insn = read_memory_unsigned_integer (pc, 4, byte_order_for_code);
if (bits (insn, 28, 31) != INST_NV)
{
if ((insn & 0x0ffffff0) == 0x012fff10)
/* BX. */
found_return = 1;
else if ((insn & 0x0ffffff0) == 0x01a0f000)
/* MOV PC. */
found_return = 1;
else if ((insn & 0x0fff0000) == 0x08bd0000
&& (insn & 0x0000c000) != 0)
/* POP (LDMIA), including PC or LR. */
found_return = 1;
}
if (!found_return)
return 0;
/* Scan backwards. This is just a heuristic, so do not worry about
false positives from mode changes. */
if (pc < func_start + 4)
return 0;
insn = read_memory_unsigned_integer (pc - 4, 4, byte_order_for_code);
if (arm_instruction_restores_sp (insn))
return 1;
return 0;
}
/* Implement the stack_frame_destroyed_p gdbarch method. */
static int
arm_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
{
if (arm_pc_is_thumb (gdbarch, pc))
return thumb_stack_frame_destroyed_p (gdbarch, pc);
else
return arm_stack_frame_destroyed_p_1 (gdbarch, pc);
}
/* When arguments must be pushed onto the stack, they go on in reverse
order. The code below implements a FILO (stack) to do this. */
struct stack_item
{
int len;
struct stack_item *prev;
Change some void* to gdb_byte* There are a bunch of places where a void* is implicitely casted into a gdb_byte*. The auto-insert-casts script added explicit casts at those places. However, in many cases, it makes more sense to just change the void* to a gdb_byte*. gdb/ChangeLog: * aarch64-tdep.c (stack_item_t): Change type of data to gdb_byte*. * arm-tdep.c (struct stack_item): Likewise. (push_stack_item): Add gdb_byte* cast. * avr-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * cli/cli-dump.c (dump_memory_to_file): Change type of buf to gdb_byte* and add cast. * cris-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * gcore.c (gcore_copy_callback): Change type of memhunk to gdb_byte* and add cast. * gdbtypes.h (print_scalar_formatted): Change type of first parameter to gdb_byte*. * h8300-tdep.c (h8300_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (h8300h_extract_return_value): Likewise. (h8300_store_return_value): Change type of valbuf to gdb_byte*. (h8300h_store_return_value): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. * jit.c (jit_reader_try_read_symtab): Change type of gdb_mem to gdb_byte* and add cast. * m32r-tdep.c (m32r_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (m32r_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * mep-tdep.c (mep_pseudo_cr32_read): Change type of buf to gdb_byte*. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_csr_write): Likewise. (mep_pseudo_cr32_write): Likewise. (mep_pseudo_cr64_write): Likewise. * mi/mi-main.c (mi_cmd_data_write_memory): Change type of buffer to gdb_byte* and add cast. * moxie-tdep.c (moxie_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (moxie_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * p-valprint.c (print_scalar_formatted): Change type of valaddr to gdb_byte*. * printcmd.c (void): Likewise. * python/py-inferior.c (infpy_read_memory): Change type of buffer to gdb_byte* and add cast. (infpy_write_memory): Likewise. (infpy_search_memory): Likewise. * regcache.c (regcache_raw_write_signed): Change type of buf to gdb_byte* and add cast. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. * sh64-tdep.c (h64_extract_return_value): Change type of valbuf to gdb_byte*.
2015-10-09 16:08:23 +02:00
gdb_byte *data;
};
static struct stack_item *
push_stack_item (struct stack_item *prev, const gdb_byte *contents, int len)
{
struct stack_item *si;
Replace some xmalloc-family functions with XNEW-family ones This patch is part of the make-gdb-buildable-in-C++ effort. The idea is to change some calls to the xmalloc family of functions to calls to the equivalents in the XNEW family. This avoids adding an explicit cast, so it keeps the code a bit more readable. Some of them also map relatively well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be possible to do scripted replacements if needed. I only changed calls that were obviously allocating memory for one or multiple "objects". Allocation of variable sizes (such as strings or buffer handling) will be for later (and won't use XNEW). - xmalloc (sizeof (struct foo)) -> XNEW (struct foo) - xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num) - xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo) - xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num) - xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num) - obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo) - obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num) - alloca (sizeof (struct foo)) -> XALLOCA (struct foo) - alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num) Some instances of xmalloc followed by memset to zero the buffer were replaced by XCNEW or XCNEWVEC. I regtested on x86-64, Ubuntu 14.04, but the patch touches many architecture-specific files. For those I'll have to rely on the buildbot or people complaining that I broke their gdb. gdb/ChangeLog: * aarch64-linux-nat.c (aarch64_add_process): Likewise. * aarch64-tdep.c (aarch64_gdbarch_init): Likewise. * ada-exp.y (write_ambiguous_var): Likewise. * ada-lang.c (resolve_subexp): Likewise. (user_select_syms): Likewise. (assign_aggregate): Likewise. (ada_evaluate_subexp): Likewise. (cache_symbol): Likewise. * addrmap.c (allocate_key): Likewise. (addrmap_create_mutable): Likewise. * aix-thread.c (sync_threadlists): Likewise. * alpha-tdep.c (alpha_push_dummy_call): Likewise. (alpha_gdbarch_init): Likewise. * amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise. * arm-linux-nat.c (arm_linux_add_process): Likewise. * arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise. * arm-tdep.c (push_stack_item): Likewise. (arm_displaced_step_copy_insn): Likewise. (arm_gdbarch_init): Likewise. (_initialize_arm_tdep): Likewise. * avr-tdep.c (push_stack_item): Likewise. * ax-general.c (new_agent_expr): Likewise. * block.c (block_initialize_namespace): Likewise. * breakpoint.c (alloc_counted_command_line): Likewise. (update_dprintf_command_list): Likewise. (parse_breakpoint_sals): Likewise. (decode_static_tracepoint_spec): Likewise. (until_break_command): Likewise. (clear_command): Likewise. (update_global_location_list): Likewise. (get_breakpoint_objfile_data) Likewise. * btrace.c (ftrace_new_function): Likewise. (btrace_set_insn_history): Likewise. (btrace_set_call_history): Likewise. * buildsym.c (add_symbol_to_list): Likewise. (record_pending_block): Likewise. (start_subfile): Likewise. (start_buildsym_compunit): Likewise. (push_subfile): Likewise. (end_symtab_get_static_block): Likewise. (buildsym_init): Likewise. * cli/cli-cmds.c (source_command): Likewise. * cli/cli-decode.c (add_cmd): Likewise. * cli/cli-script.c (build_command_line): Likewise. (setup_user_args): Likewise. (realloc_body_list): Likewise. (process_next_line): Likewise. (copy_command_lines): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (read_pe_exported_syms): Likewise. * coffread.c (coff_locate_sections): Likewise. (coff_symtab_read): Likewise. (coff_read_struct_type): Likewise. * common/cleanups.c (make_my_cleanup2): Likewise. * common/common-exceptions.c (throw_it): Likewise. * common/filestuff.c (make_cleanup_close): Likewise. * common/format.c (parse_format_string): Likewise. * common/queue.h (DEFINE_QUEUE_P): Likewise. * compile/compile-object-load.c (munmap_list_add): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * compile/compile.c (append_args): Likewise. * corefile.c (specify_exec_file_hook): Likewise. * cp-support.c (make_symbol_overload_list): Likewise. * cris-tdep.c (push_stack_item): Likewise. (cris_gdbarch_init): Likewise. * ctf.c (ctf_trace_file_writer_new): Likewise. * dbxread.c (init_header_files): Likewise. (add_new_header_file): Likewise. (init_bincl_list): Likewise. (dbx_end_psymtab): Likewise. (start_psymtab): Likewise. (dbx_end_psymtab): Likewise. * dcache.c (dcache_init): Likewise. * dictionary.c (dict_create_hashed): Likewise. (dict_create_hashed_expandable): Likewise. (dict_create_linear): Likewise. (dict_create_linear_expandable): Likewise. * dtrace-probe.c (dtrace_process_dof_probe): Likewise. * dummy-frame.c (register_dummy_frame_dtor): Likewise. * dwarf2-frame-tailcall.c (cache_new_ref1): Likewise. * dwarf2-frame.c (dwarf2_build_frame_info): Likewise. (decode_frame_entry_1): Likewise. * dwarf2expr.c (new_dwarf_expr_context): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. * dwarf2read.c (dwarf2_has_info): Likewise. (create_signatured_type_table_from_index): Likewise. (dwarf2_read_index): Likewise. (dw2_get_file_names_reader): Likewise. (create_all_type_units): Likewise. (read_cutu_die_from_dwo): Likewise. (init_tu_and_read_dwo_dies): Likewise. (init_cutu_and_read_dies): Likewise. (create_all_comp_units): Likewise. (queue_comp_unit): Likewise. (inherit_abstract_dies): Likewise. (read_call_site_scope): Likewise. (dwarf2_add_field): Likewise. (dwarf2_add_typedef): Likewise. (dwarf2_add_member_fn): Likewise. (attr_to_dynamic_prop): Likewise. (abbrev_table_alloc_abbrev): Likewise. (abbrev_table_read_table): Likewise. (add_include_dir): Likewise. (add_file_name): Likewise. (dwarf_decode_line_header): Likewise. (dwarf2_const_value_attr): Likewise. (dwarf_alloc_block): Likewise. (parse_macro_definition): Likewise. (set_die_type): Likewise. (write_psymtabs_to_index): Likewise. (create_cus_from_index): Likewise. (dwarf2_create_include_psymtab): Likewise. (process_psymtab_comp_unit_reader): Likewise. (build_type_psymtab_dependencies): Likewise. (read_comp_units_from_section): Likewise. (compute_compunit_symtab_includes): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (load_partial_dies): Likewise. (dwarf2_symbol_mark_computed): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_read_minimal_symbols): Likewise. * environ.c (make_environ): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * event-loop.c (create_file_handler): Likewise. (create_async_signal_handler): Likewise. (create_async_event_handler): Likewise. (create_timer): Likewise. * exec.c (build_section_table): Likewise. * fbsd-nat.c (fbsd_remember_child): Likewise. * fork-child.c (fork_inferior): Likewise. * frv-tdep.c (new_variant): Likewise. * gdbarch.sh (gdbarch_alloc): Likewise. (append_name): Likewise. * gdbtypes.c (rank_function): Likewise. (copy_type_recursive): Likewise. (add_dyn_prop): Likewise. * gnu-nat.c (make_proc): Likewise. (make_inf): Likewise. (gnu_write_inferior): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise. (build_std_type_info_type): Likewise. * guile/scm-param.c (compute_enum_list): Likewise. * guile/scm-utils.c (gdbscm_parse_function_args): Likewise. * guile/scm-value.c (gdbscm_value_call): Likewise. * h8300-tdep.c (h8300_gdbarch_init): Likewise. * hppa-tdep.c (hppa_init_objfile_priv_data): Likewise. (read_unwind_info): Likewise. * ia64-tdep.c (ia64_gdbarch_init): Likewise. * infcall.c (dummy_frame_context_saver_setup): Likewise. (call_function_by_hand_dummy): Likewise. * infcmd.c (step_once): Likewise. (finish_forward): Likewise. (attach_command): Likewise. (notice_new_inferior): Likewise. * inferior.c (add_inferior_silent): Likewise. * infrun.c (add_displaced_stepping_state): Likewise. (save_infcall_control_state): Likewise. (save_inferior_ptid): Likewise. (_initialize_infrun): Likewise. * jit.c (bfd_open_from_target_memory): Likewise. (jit_gdbarch_data_init): Likewise. * language.c (add_language): Likewise. * linespec.c (decode_line_2): Likewise. * linux-nat.c (add_to_pid_list): Likewise. (add_initial_lwp): Likewise. * linux-thread-db.c (add_thread_db_info): Likewise. (record_thread): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_gdbarch_init): Likewise. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * m68k-tdep.c (m68k_gdbarch_init): Likewise. * m88k-tdep.c (m88k_analyze_prologue): Likewise. * macrocmd.c (macro_define_command): Likewise. * macroexp.c (gather_arguments): Likewise. * macroscope.c (sal_macro_scope): Likewise. * macrotab.c (new_macro_table): Likewise. * mdebugread.c (push_parse_stack): Likewise. (parse_partial_symbols): Likewise. (parse_symbol): Likewise. (psymtab_to_symtab_1): Likewise. (new_block): Likewise. (new_psymtab): Likewise. (mdebug_build_psymtabs): Likewise. (add_pending): Likewise. (elfmdebug_build_psymtabs): Likewise. * mep-tdep.c (mep_gdbarch_init): Likewise. * mi/mi-main.c (mi_execute_command): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. * minidebug.c (lzma_open): Likewise. * minsyms.c (terminate_minimal_symbol_table): Likewise. * mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * mt-tdep.c (mt_registers_info): Likewise. * nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise. * nat/linux-btrace.c (linux_enable_bts): Likewise. (linux_enable_pt): Likewise. * nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise. (linux_xfer_osdata_processgroups): Likewise. * nios2-tdep.c (nios2_gdbarch_init): Likewise. * nto-procfs.c (procfs_meminfo): Likewise. * objc-lang.c (start_msglist): Likewise. (selectors_info): Likewise. (classes_info): Likewise. (find_methods): Likewise. * objfiles.c (allocate_objfile): Likewise. (update_section_map): Likewise. * osabi.c (gdbarch_register_osabi): Likewise. (gdbarch_register_osabi_sniffer): Likewise. * parse.c (start_arglist): Likewise. * ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise. (hwdebug_insert_point): Likewise. * printcmd.c (display_command): Likewise. (ui_printf): Likewise. * procfs.c (create_procinfo): Likewise. (load_syscalls): Likewise. (proc_get_LDT_entry): Likewise. (proc_update_threads): Likewise. * prologue-value.c (make_pv_area): Likewise. (pv_area_store): Likewise. * psymtab.c (extend_psymbol_list): Likewise. (init_psymbol_list): Likewise. (allocate_psymtab): Likewise. * python/py-inferior.c (add_thread_object): Likewise. * python/py-param.c (compute_enum_values): Likewise. * python/py-value.c (valpy_call): Likewise. * python/py-varobj.c (py_varobj_iter_next): Likewise. * python/python.c (ensure_python_env): Likewise. * record-btrace.c (record_btrace_start_replaying): Likewise. * record-full.c (record_full_reg_alloc): Likewise. (record_full_mem_alloc): Likewise. (record_full_end_alloc): Likewise. (record_full_core_xfer_partial): Likewise. * regcache.c (get_thread_arch_aspace_regcache): Likewise. * remote-fileio.c (remote_fileio_init_fd_map): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (demand_private_info): Likewise. (remote_notif_stop_alloc_reply): Likewise. (remote_enable_btrace): Likewise. * reverse.c (save_bookmark_command): Likewise. * rl78-tdep.c (rl78_gdbarch_init): Likewise. * rx-tdep.c (rx_gdbarch_init): Likewise. * s390-linux-nat.c (s390_insert_watchpoint): Likewise. * ser-go32.c (dos_get_tty_state): Likewise. (dos_copy_tty_state): Likewise. * ser-mingw.c (ser_windows_open): Likewise. (ser_console_wait_handle): Likewise. (ser_console_get_tty_state): Likewise. (make_pipe_state): Likewise. (net_windows_open): Likewise. * ser-unix.c (hardwire_get_tty_state): Likewise. (hardwire_copy_tty_state): Likewise. * solib-aix.c (solib_aix_new_lm_info): Likewise. * solib-dsbt.c (dsbt_current_sos): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (frv_current_sos): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_bfd_fopen): Likewise. * solib-svr4.c (lm_info_read): Likewise. (svr4_copy_library_list): Likewise. (svr4_default_sos): Likewise. * source.c (find_source_lines): Likewise. (line_info): Likewise. (add_substitute_path_rule): Likewise. * spu-linux-nat.c (spu_bfd_open): Likewise. * spu-tdep.c (info_spu_dma_cmdlist): Likewise. * stabsread.c (dbx_lookup_type): Likewise. (read_type): Likewise. (read_member_functions): Likewise. (read_struct_fields): Likewise. (read_baseclasses): Likewise. (read_args): Likewise. (_initialize_stabsread): Likewise. * stack.c (func_command): Likewise. * stap-probe.c (handle_stap_probe): Likewise. * symfile.c (addrs_section_sort): Likewise. (addr_info_make_relative): Likewise. (load_section_callback): Likewise. (add_symbol_file_command): Likewise. (init_filename_language_table): Likewise. * symtab.c (create_filename_seen_cache): Likewise. (sort_search_symbols_remove_dups): Likewise. (search_symbols): Likewise. * target.c (make_cleanup_restore_target_terminal): Likewise. * thread.c (new_thread): Likewise. (enable_thread_stack_temporaries): Likewise. (make_cleanup_restore_current_thread): Likewise. (thread_apply_all_command): Likewise. * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. * top.c (gdb_readline_wrapper): Likewise. * tracefile-tfile.c (tfile_trace_file_writer_new): Likewise. * tracepoint.c (trace_find_line_command): Likewise. (all_tracepoint_actions_and_cleanup): Likewise. (make_cleanup_restore_current_traceframe): Likewise. (get_uploaded_tp): Likewise. (get_uploaded_tsv): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_alloc_content): Likewise. (tui_add_content_elements): Likewise. * tui/tui-disasm.c (tui_find_disassembly_address): Likewise. (tui_set_disassem_content): Likewise. * ui-file.c (ui_file_new): Likewise. (stdio_file_new): Likewise. (tee_file_new): Likewise. * utils.c (make_cleanup_restore_integer): Likewise. (add_internal_problem_command): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise. * valops.c (find_oload_champ): Likewise. * value.c (allocate_value_lazy): Likewise. (record_latest_value): Likewise. (create_internalvar): Likewise. * varobj.c (install_variable): Likewise. (new_variable): Likewise. (new_root_variable): Likewise. (cppush): Likewise. (_initialize_varobj): Likewise. * windows-nat.c (windows_make_so): Likewise. * x86-nat.c (x86_add_process): Likewise. * xcoffread.c (arrange_linetable): Likewise. (allocate_include_entry): Likewise. (process_linenos): Likewise. (SYMBOL_DUP): Likewise. (xcoff_start_psymtab): Likewise. (xcoff_end_psymtab): Likewise. * xml-support.c (gdb_xml_parse_attr_ulongest): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Likewise. (compile_bytecodes): Likewise. * dll.c (loaded_dll): Likewise. * event-loop.c (append_callback_event): Likewise. (create_file_handler): Likewise. (create_file_event): Likewise. * hostio.c (handle_open): Likewise. * inferiors.c (add_thread): Likewise. (add_process): Likewise. * linux-aarch64-low.c (aarch64_linux_new_process): Likewise. * linux-arm-low.c (arm_new_process): Likewise. (arm_new_thread): Likewise. * linux-low.c (add_to_pid_list): Likewise. (linux_add_process): Likewise. (handle_extended_wait): Likewise. (add_lwp): Likewise. (enqueue_one_deferred_signal): Likewise. (enqueue_pending_signal): Likewise. (linux_resume_one_lwp_throw): Likewise. (linux_resume_one_thread): Likewise. (linux_read_memory): Likewise. (linux_write_memory): Likewise. * linux-mips-low.c (mips_linux_new_process): Likewise. (mips_linux_new_thread): Likewise. (mips_add_watchpoint): Likewise. * linux-x86-low.c (initialize_low_arch): Likewise. * lynx-low.c (lynx_add_process): Likewise. * mem-break.c (set_raw_breakpoint_at): Likewise. (set_breakpoint): Likewise. (add_condition_to_breakpoint): Likewise. (add_commands_to_breakpoint): Likewise. (clone_agent_expr): Likewise. (clone_one_breakpoint): Likewise. * regcache.c (new_register_cache): Likewise. * remote-utils.c (look_up_one_symbol): Likewise. * server.c (queue_stop_reply): Likewise. (start_inferior): Likewise. (queue_stop_reply_callback): Likewise. (handle_target_event): Likewise. * spu-low.c (fetch_ppc_memory): Likewise. (store_ppc_memory): Likewise. * target.c (set_target_ops): Likewise. * thread-db.c (thread_db_load_search): Likewise. (try_thread_db_load_1): Likewise. * tracepoint.c (add_tracepoint): Likewise. (add_tracepoint_action): Likewise. (create_trace_state_variable): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtro): Likewise. (add_while_stepping_state): Likewise. * win32-low.c (child_add_thread): Likewise. (get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
si = XNEW (struct stack_item);
Change some void* to gdb_byte* There are a bunch of places where a void* is implicitely casted into a gdb_byte*. The auto-insert-casts script added explicit casts at those places. However, in many cases, it makes more sense to just change the void* to a gdb_byte*. gdb/ChangeLog: * aarch64-tdep.c (stack_item_t): Change type of data to gdb_byte*. * arm-tdep.c (struct stack_item): Likewise. (push_stack_item): Add gdb_byte* cast. * avr-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * cli/cli-dump.c (dump_memory_to_file): Change type of buf to gdb_byte* and add cast. * cris-tdep.c (struct stack_item): Change type of data to gdb_byte*. (push_stack_item): Add gdb_byte* cast. * gcore.c (gcore_copy_callback): Change type of memhunk to gdb_byte* and add cast. * gdbtypes.h (print_scalar_formatted): Change type of first parameter to gdb_byte*. * h8300-tdep.c (h8300_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (h8300h_extract_return_value): Likewise. (h8300_store_return_value): Change type of valbuf to gdb_byte*. (h8300h_store_return_value): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. * jit.c (jit_reader_try_read_symtab): Change type of gdb_mem to gdb_byte* and add cast. * m32r-tdep.c (m32r_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (m32r_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * mep-tdep.c (mep_pseudo_cr32_read): Change type of buf to gdb_byte*. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_csr_write): Likewise. (mep_pseudo_cr32_write): Likewise. (mep_pseudo_cr64_write): Likewise. * mi/mi-main.c (mi_cmd_data_write_memory): Change type of buffer to gdb_byte* and add cast. * moxie-tdep.c (moxie_store_return_value): Change type of valbuf to gdb_byte* and remove unnecessary cast. (moxie_extract_return_value): Change type of dst to gdb_byte* and remove valbuf. * p-valprint.c (print_scalar_formatted): Change type of valaddr to gdb_byte*. * printcmd.c (void): Likewise. * python/py-inferior.c (infpy_read_memory): Change type of buffer to gdb_byte* and add cast. (infpy_write_memory): Likewise. (infpy_search_memory): Likewise. * regcache.c (regcache_raw_write_signed): Change type of buf to gdb_byte* and add cast. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. * sh64-tdep.c (h64_extract_return_value): Change type of valbuf to gdb_byte*.
2015-10-09 16:08:23 +02:00
si->data = (gdb_byte *) xmalloc (len);
si->len = len;
si->prev = prev;
memcpy (si->data, contents, len);
return si;
}
static struct stack_item *
pop_stack_item (struct stack_item *si)
{
struct stack_item *dead = si;
si = si->prev;
xfree (dead->data);
xfree (dead);
return si;
}
/* Implement the gdbarch type alignment method, overrides the generic
alignment algorithm for anything that is arm specific. */
static ULONGEST
arm_type_align (gdbarch *gdbarch, struct type *t)
{
t = check_typedef (t);
if (t->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (t))
{
/* Use the natural alignment for vector types (the same for
scalar type), but the maximum alignment is 64-bit. */
if (TYPE_LENGTH (t) > 8)
return 8;
else
return TYPE_LENGTH (t);
}
/* Allow the common code to calculate the alignment. */
return 0;
}
/* Possible base types for a candidate for passing and returning in
VFP registers. */
enum arm_vfp_cprc_base_type
{
VFP_CPRC_UNKNOWN,
VFP_CPRC_SINGLE,
VFP_CPRC_DOUBLE,
VFP_CPRC_VEC64,
VFP_CPRC_VEC128
};
/* The length of one element of base type B. */
static unsigned
arm_vfp_cprc_unit_length (enum arm_vfp_cprc_base_type b)
{
switch (b)
{
case VFP_CPRC_SINGLE:
return 4;
case VFP_CPRC_DOUBLE:
return 8;
case VFP_CPRC_VEC64:
return 8;
case VFP_CPRC_VEC128:
return 16;
default:
internal_error (__FILE__, __LINE__, _("Invalid VFP CPRC type: %d."),
(int) b);
}
}
/* The character ('s', 'd' or 'q') for the type of VFP register used
for passing base type B. */
static int
arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b)
{
switch (b)
{
case VFP_CPRC_SINGLE:
return 's';
case VFP_CPRC_DOUBLE:
return 'd';
case VFP_CPRC_VEC64:
return 'd';
case VFP_CPRC_VEC128:
return 'q';
default:
internal_error (__FILE__, __LINE__, _("Invalid VFP CPRC type: %d."),
(int) b);
}
}
/* Determine whether T may be part of a candidate for passing and
returning in VFP registers, ignoring the limit on the total number
of components. If *BASE_TYPE is VFP_CPRC_UNKNOWN, set it to the
classification of the first valid component found; if it is not
VFP_CPRC_UNKNOWN, all components must have the same classification
as *BASE_TYPE. If it is found that T contains a type not permitted
for passing and returning in VFP registers, a type differently
classified from *BASE_TYPE, or two types differently classified
from each other, return -1, otherwise return the total number of
base-type elements found (possibly 0 in an empty structure or
Support _Complex in hard-VFP abi Hi, When we pass "-mfloat-abi=hard" flag in the GDB testing, we see the following fails, FAIL: gdb.base/callfuncs.exp: p t_float_complex_values(fc1, fc2) FAIL: gdb.base/callfuncs.exp: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4) FAIL: gdb.base/callfuncs.exp: p t_double_complex_values(dc1, dc2) FAIL: gdb.base/callfuncs.exp: p t_double_complex_many_args(dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4) FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_values(ldc1, ldc2) FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_many_args(ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4) FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex The hard-VFP ABI was supported by GDB overal, done by this patch https://sourceware.org/ml/gdb-patches/2009-07/msg00686.html but "vectors and complex types are not currently supported", mentioned in the patch. As a result, these tests fail. This patch is to support _Complex types in hard-VFP abi. As specified in "7.1.1, Procedure Call Standard for the ARM Arch", the layout of _Complex types is a struct, which is identical to the layout on amd64, so I copy Mark's comments to amd64 support. Regression tested on arm-none-eabi target. OK to apply? gdb: 2014-08-19 Yao Qi <yao@codesourcery.com> * arm-tdep.c (arm_vfp_cprc_sub_candidate): Handle _Complex types.
2014-08-11 13:02:58 +02:00
array). Vector types are not currently supported, matching the
generic AAPCS support. */
static int
arm_vfp_cprc_sub_candidate (struct type *t,
enum arm_vfp_cprc_base_type *base_type)
{
t = check_typedef (t);
switch (t->code ())
{
case TYPE_CODE_FLT:
switch (TYPE_LENGTH (t))
{
case 4:
if (*base_type == VFP_CPRC_UNKNOWN)
*base_type = VFP_CPRC_SINGLE;
else if (*base_type != VFP_CPRC_SINGLE)
return -1;
return 1;
case 8:
if (*base_type == VFP_CPRC_UNKNOWN)
*base_type = VFP_CPRC_DOUBLE;
else if (*base_type != VFP_CPRC_DOUBLE)
return -1;
return 1;
default:
return -1;
}
break;
Support _Complex in hard-VFP abi Hi, When we pass "-mfloat-abi=hard" flag in the GDB testing, we see the following fails, FAIL: gdb.base/callfuncs.exp: p t_float_complex_values(fc1, fc2) FAIL: gdb.base/callfuncs.exp: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4) FAIL: gdb.base/callfuncs.exp: p t_double_complex_values(dc1, dc2) FAIL: gdb.base/callfuncs.exp: p t_double_complex_many_args(dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4) FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_values(ldc1, ldc2) FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_many_args(ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4) FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex The hard-VFP ABI was supported by GDB overal, done by this patch https://sourceware.org/ml/gdb-patches/2009-07/msg00686.html but "vectors and complex types are not currently supported", mentioned in the patch. As a result, these tests fail. This patch is to support _Complex types in hard-VFP abi. As specified in "7.1.1, Procedure Call Standard for the ARM Arch", the layout of _Complex types is a struct, which is identical to the layout on amd64, so I copy Mark's comments to amd64 support. Regression tested on arm-none-eabi target. OK to apply? gdb: 2014-08-19 Yao Qi <yao@codesourcery.com> * arm-tdep.c (arm_vfp_cprc_sub_candidate): Handle _Complex types.
2014-08-11 13:02:58 +02:00
case TYPE_CODE_COMPLEX:
/* Arguments of complex T where T is one of the types float or
double get treated as if they are implemented as:
struct complexT
{
T real;
T imag;
};
*/
Support _Complex in hard-VFP abi Hi, When we pass "-mfloat-abi=hard" flag in the GDB testing, we see the following fails, FAIL: gdb.base/callfuncs.exp: p t_float_complex_values(fc1, fc2) FAIL: gdb.base/callfuncs.exp: p t_float_complex_many_args(fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4, fc1, fc2, fc3, fc4) FAIL: gdb.base/callfuncs.exp: p t_double_complex_values(dc1, dc2) FAIL: gdb.base/callfuncs.exp: p t_double_complex_many_args(dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4, dc1, dc2, dc3, dc4) FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_values(ldc1, ldc2) FAIL: gdb.base/callfuncs.exp: p t_long_double_complex_many_args(ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4, ldc1, ldc2, ldc3, ldc4) FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex The hard-VFP ABI was supported by GDB overal, done by this patch https://sourceware.org/ml/gdb-patches/2009-07/msg00686.html but "vectors and complex types are not currently supported", mentioned in the patch. As a result, these tests fail. This patch is to support _Complex types in hard-VFP abi. As specified in "7.1.1, Procedure Call Standard for the ARM Arch", the layout of _Complex types is a struct, which is identical to the layout on amd64, so I copy Mark's comments to amd64 support. Regression tested on arm-none-eabi target. OK to apply? gdb: 2014-08-19 Yao Qi <yao@codesourcery.com> * arm-tdep.c (arm_vfp_cprc_sub_candidate): Handle _Complex types.
2014-08-11 13:02:58 +02:00
switch (TYPE_LENGTH (t))
{
case 8:
if (*base_type == VFP_CPRC_UNKNOWN)
*base_type = VFP_CPRC_SINGLE;
else if (*base_type != VFP_CPRC_SINGLE)
return -1;
return 2;
case 16:
if (*base_type == VFP_CPRC_UNKNOWN)
*base_type = VFP_CPRC_DOUBLE;
else if (*base_type != VFP_CPRC_DOUBLE)
return -1;
return 2;
default:
return -1;
}
break;
case TYPE_CODE_ARRAY:
{
if (TYPE_VECTOR (t))
{
/* A 64-bit or 128-bit containerized vector type are VFP
CPRCs. */
switch (TYPE_LENGTH (t))
{
case 8:
if (*base_type == VFP_CPRC_UNKNOWN)
*base_type = VFP_CPRC_VEC64;
return 1;
case 16:
if (*base_type == VFP_CPRC_UNKNOWN)
*base_type = VFP_CPRC_VEC128;
return 1;
default:
return -1;
}
}
else
{
int count;
unsigned unitlen;
count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t),
base_type);
if (count == -1)
return -1;
if (TYPE_LENGTH (t) == 0)
{
gdb_assert (count == 0);
return 0;
}
else if (count == 0)
return -1;
unitlen = arm_vfp_cprc_unit_length (*base_type);
gdb_assert ((TYPE_LENGTH (t) % unitlen) == 0);
return TYPE_LENGTH (t) / unitlen;
}
}
break;
case TYPE_CODE_STRUCT:
{
int count = 0;
unsigned unitlen;
int i;
for (i = 0; i < t->num_fields (); i++)
{
int sub_count = 0;
if (!field_is_static (&t->field (i)))
sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
base_type);
if (sub_count == -1)
return -1;
count += sub_count;
}
if (TYPE_LENGTH (t) == 0)
{
gdb_assert (count == 0);
return 0;
}
else if (count == 0)
return -1;
unitlen = arm_vfp_cprc_unit_length (*base_type);
if (TYPE_LENGTH (t) != unitlen * count)
return -1;
return count;
}
case TYPE_CODE_UNION:
{
int count = 0;
unsigned unitlen;
int i;
for (i = 0; i < t->num_fields (); i++)
{
int sub_count = arm_vfp_cprc_sub_candidate (t->field (i).type (),
base_type);
if (sub_count == -1)
return -1;
count = (count > sub_count ? count : sub_count);
}
if (TYPE_LENGTH (t) == 0)
{
gdb_assert (count == 0);
return 0;
}
else if (count == 0)
return -1;
unitlen = arm_vfp_cprc_unit_length (*base_type);
if (TYPE_LENGTH (t) != unitlen * count)
return -1;
return count;
}
default:
break;
}
return -1;
}
/* Determine whether T is a VFP co-processor register candidate (CPRC)
if passed to or returned from a non-variadic function with the VFP
ABI in effect. Return 1 if it is, 0 otherwise. If it is, set
*BASE_TYPE to the base type for T and *COUNT to the number of
elements of that base type before returning. */
static int
arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type,
int *count)
{
enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN;
int c = arm_vfp_cprc_sub_candidate (t, &b);
if (c <= 0 || c > 4)
return 0;
*base_type = b;
*count = c;
return 1;
}
/* Return 1 if the VFP ABI should be used for passing arguments to and
returning values from a function of type FUNC_TYPE, 0
otherwise. */
static int
arm_vfp_abi_for_function (struct gdbarch *gdbarch, struct type *func_type)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Variadic functions always use the base ABI. Assume that functions
without debug info are not variadic. */
if (func_type && TYPE_VARARGS (check_typedef (func_type)))
return 0;
/* The VFP ABI is only supported as a variant of AAPCS. */
if (tdep->arm_abi != ARM_ABI_AAPCS)
return 0;
return gdbarch_tdep (gdbarch)->fp_model == ARM_FLOAT_VFP;
}
/* We currently only support passing parameters in integer registers, which
conforms with GCC's default model, and VFP argument passing following
the VFP variant of AAPCS. Several other variants exist and
we should probably support some of them based on the selected ABI. */
static CORE_ADDR
2004-06-06 Randolph Chung <tausq@debian.org> * gdbarch.sh (PUSH_DUMMY_CALL): Change CORE_ADDR func_addr argument to struct value *function. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * infcall.c (call_function_by_hand): Pass entire function value to push_dummy_call. * Makefile.in (alpha-tdep.o, frv-tdep.o, ia64-tdep.o, mips-tdep.o) (ppc-sysv-tdep.o, rs6000-tdep.o): Update dependencies. * alpha-tdep.c (alpha_push_dummy_call): Update call signature. * amd64-tdep.c (amd64_push_dummy_call): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * avr-tdep.c (avr_push_dummy_call): Likewise. * cris-tdep.c (cris_push_dummy_call): Likewise. * d10v-tdep.c (d10v_push_dummy_call): Likewise. * frv-tdep.c (frv_push_dummy_call): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (hppa32_push_dummy_call) (hppa64_push_dummy_call): Likewise. * i386-tdep.c (i386_push_dummy_call): Likewise. * ia64-tdep.c (ia64_push_dummy_call): Likewise. * m32r-tdep.c (m32r_push_dummy_call): Likewise. * m68hc11-tdep.c (m68hc11_push_dummy_call): Likewise. * m68k-tdep.c (m68k_push_dummy_call): Likewise. * m88k-tdep.c (m88k_push_dummy_call): Likewise. * mips-tdep.c (mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call) (mips_o32_push_dummy_call, mips_o64_push_dummy_call): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call) (ppc64_sysv_abi_push_dummy_call): Likewise. * ppc-tdep.h (ppc_sysv_abi_push_dummy_call) (ppc64_sysv_abi_push_dummy_call): Likewise. * rs6000-tdep.c (rs6000_push_dummy_call): Likewise. * s390-tdep.c (s390_push_dummy_call): Likewise. * sh-tdep.c (sh_push_dummy_call_fpu) (sh_push_dummy_call_nofpu): Likewise. * sparc-tdep.c (sparc32_push_dummy_call): Likewise. * sparc64-tdep.c (sparc64_push_dummy_call): Likewise. * vax-tdep.c (vax_push_dummy_call): Likewise.
2004-06-07 04:02:55 +02:00
arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
Pass return_method to _push_dummy_call gdb/ChangeLog: * aarch64-tdep.c (aarch64_push_dummy_call): Replace arg with return_method. * alpha-tdep.c (alpha_push_dummy_call): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_push_dummy_call): Likewise. * amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise. * arc-tdep.c (arc_push_dummy_call): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * avr-tdep.c (avr_push_dummy_call): Likewise. * bfin-tdep.c (bfin_push_dummy_call): Likewise. * cris-tdep.c (cris_push_dummy_call): Likewise. * csky-tdep.c (csky_push_dummy_call): Likewise. * frv-tdep.c (frv_push_dummy_call): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (gdbarch_push_dummy_call): Replace arg with return_method. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (hppa32_push_dummy_call): Likewise. (hppa64_push_dummy_call): Likewise. * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Likewise. * i386-tdep.c (i386_push_dummy_call): Likewise. * ia64-tdep.c (ia64_push_dummy_call): Likewise. * infcall.c (call_function_by_hand_dummy): Likewise. * iq2000-tdep.c (iq2000_push_dummy_call): Likewise. * lm32-tdep.c (lm32_push_dummy_call): Likewise. * m32c-tdep.c (m32c_push_dummy_call): Likewise. * m32r-tdep.c (m32r_push_dummy_call): Likewise. * m68hc11-tdep.c (m68hc11_push_dummy_call): Likewise. * m68k-tdep.c (m68k_push_dummy_call): Likewise. * mep-tdep.c (mep_push_dummy_call): Likewise. * mips-tdep.c (mips_eabi_push_dummy_call): Likewise. (mips_n32n64_push_dummy_call): Likewise. (mips_o32_push_dummy_call): Likewise. (mips_o64_push_dummy_call): Likewise. * mn10300-tdep.c (mn10300_push_dummy_call): Likewise. * msp430-tdep.c (msp430_push_dummy_call): Likewise. * nds32-tdep.c (nds32_push_dummy_call): Likewise. * nios2-tdep.c (nios2_push_dummy_call): Likewise. * or1k-tdep.c (or1k_push_dummy_call): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Likewise. (ppc64_sysv_abi_push_dummy_call): Likewise. * ppc-tdep.h (ppc_sysv_abi_push_dummy_call): Likewise. (ppc64_sysv_abi_push_dummy_call): Likewise. * riscv-tdep.c (riscv_push_dummy_call): Likewise. * rl78-tdep.c (rl78_push_dummy_call): Likewise. * rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise. * rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise. * rx-tdep.c (rx_push_dummy_call): Likewise. * s390-tdep.c (s390_push_dummy_call): Likewise. * score-tdep.c (score_push_dummy_call): Likewise. * sh-tdep.c (sh_push_dummy_call_fpu): Likewise. (sh_push_dummy_call_nofpu): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc32_push_dummy_call): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_push_dummy_call): Likewise. * spu-tdep.c (spu_push_dummy_call): Likewise. * tic6x-tdep.c (tic6x_push_dummy_call): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * v850-tdep.c (v850_push_dummy_call): Likewise. * vax-tdep.c (vax_push_dummy_call): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. * xtensa-tdep.c (xtensa_push_dummy_call): Likewise.
2018-11-16 12:21:04 +01:00
struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
* 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 19:25:59 +02:00
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int argnum;
int argreg;
int nstack;
struct stack_item *si = NULL;
int use_vfp_abi;
struct type *ftype;
unsigned vfp_regs_free = (1 << 16) - 1;
/* Determine the type of this function and whether the VFP ABI
applies. */
ftype = check_typedef (value_type (function));
if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype);
/* Set the return address. For the ARM, the return breakpoint is
always at BP_ADDR. */
if (arm_pc_is_thumb (gdbarch, bp_addr))
bp_addr |= 1;
regcache_cooked_write_unsigned (regcache, ARM_LR_REGNUM, bp_addr);
/* Walk through the list of args and determine how large a temporary
stack is required. Need to take care here as structs may be
gdb * windows-tdep.c (windows_xfer_shared_library): * windows-nat.c (get_module_name, windows_make_so): * v850-tdep.c (v850_handle_pushm): * utils.c (null_cleanup, gdb_realpath): * ui-out.c (get_next_header): * tracepoint.c (clear_traceframe_info): * symtab.c (lookup_symtab): * serial.h (struct serial_ops): * mipsread.c (read_alphacoff_dynamic_symtab): * infcmd.c (print_return_value): * ia64-linux-tdep.c (ia64_linux_sigcontext_register_address): * f-exp.y (parse_number): * exceptions.c (catch_exceptions): * dummy-frame.c (dummy_frame_this_id): * defs.h (struct cleanup): * breakpoint.c (disable_breakpoints_in_unloaded_shlib): * arm-tdep.c (arm_push_dummy_call): * amd64-tdep.h (amd64_collect_xsave): * amd64-tdep.c (amd64_collect_xsave): * alpha-tdep.c (alpha_heuristic_frame_unwind_cache): * README (typing): Remove duplicate words. * cli/cli-decode.c (lookup_cmd_composition): Add comma. * infrun.c (siginfo_value_read): Fix typo. * solib-frv.c (frv_fdpic_find_global_pointer): Likewise. * top.c (source_line_number): Add comma. gdb/doc * gdbint.texinfo (Register Information Functions): Remove duplicate "the". * gdb.texinfo (Emacs): Remove duplicate "to". (GDB/MI Variable Objects): Remove duplicate "the". (General Query Packets): Likewise. gdb/testsuite * gdb.mi/mi-nsmoribund.exp: * gdb.hp/gdb.objdbg/objdbg01.exp: * gdb.base/structs.exp (test_struct_returns): * gdb.base/call-sc.exp (test_scalar_returns): * gdb.base/bigcore.exp: Remove duplicate words. gdb/gdbserver * win32-low.c (handle_load_dll): Remove duplicate "the".
2011-04-19 20:04:11 +02:00
passed on the stack, and we have to push them. */
nstack = 0;
argreg = ARM_A1_REGNUM;
nstack = 0;
/* The struct_return pointer occupies the first parameter
passing register. */
Pass return_method to _push_dummy_call gdb/ChangeLog: * aarch64-tdep.c (aarch64_push_dummy_call): Replace arg with return_method. * alpha-tdep.c (alpha_push_dummy_call): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_push_dummy_call): Likewise. * amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise. * arc-tdep.c (arc_push_dummy_call): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * avr-tdep.c (avr_push_dummy_call): Likewise. * bfin-tdep.c (bfin_push_dummy_call): Likewise. * cris-tdep.c (cris_push_dummy_call): Likewise. * csky-tdep.c (csky_push_dummy_call): Likewise. * frv-tdep.c (frv_push_dummy_call): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (gdbarch_push_dummy_call): Replace arg with return_method. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (hppa32_push_dummy_call): Likewise. (hppa64_push_dummy_call): Likewise. * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Likewise. * i386-tdep.c (i386_push_dummy_call): Likewise. * ia64-tdep.c (ia64_push_dummy_call): Likewise. * infcall.c (call_function_by_hand_dummy): Likewise. * iq2000-tdep.c (iq2000_push_dummy_call): Likewise. * lm32-tdep.c (lm32_push_dummy_call): Likewise. * m32c-tdep.c (m32c_push_dummy_call): Likewise. * m32r-tdep.c (m32r_push_dummy_call): Likewise. * m68hc11-tdep.c (m68hc11_push_dummy_call): Likewise. * m68k-tdep.c (m68k_push_dummy_call): Likewise. * mep-tdep.c (mep_push_dummy_call): Likewise. * mips-tdep.c (mips_eabi_push_dummy_call): Likewise. (mips_n32n64_push_dummy_call): Likewise. (mips_o32_push_dummy_call): Likewise. (mips_o64_push_dummy_call): Likewise. * mn10300-tdep.c (mn10300_push_dummy_call): Likewise. * msp430-tdep.c (msp430_push_dummy_call): Likewise. * nds32-tdep.c (nds32_push_dummy_call): Likewise. * nios2-tdep.c (nios2_push_dummy_call): Likewise. * or1k-tdep.c (or1k_push_dummy_call): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Likewise. (ppc64_sysv_abi_push_dummy_call): Likewise. * ppc-tdep.h (ppc_sysv_abi_push_dummy_call): Likewise. (ppc64_sysv_abi_push_dummy_call): Likewise. * riscv-tdep.c (riscv_push_dummy_call): Likewise. * rl78-tdep.c (rl78_push_dummy_call): Likewise. * rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise. * rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise. * rx-tdep.c (rx_push_dummy_call): Likewise. * s390-tdep.c (s390_push_dummy_call): Likewise. * score-tdep.c (score_push_dummy_call): Likewise. * sh-tdep.c (sh_push_dummy_call_fpu): Likewise. (sh_push_dummy_call_nofpu): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc32_push_dummy_call): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_push_dummy_call): Likewise. * spu-tdep.c (spu_push_dummy_call): Likewise. * tic6x-tdep.c (tic6x_push_dummy_call): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * v850-tdep.c (v850_push_dummy_call): Likewise. * vax-tdep.c (vax_push_dummy_call): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. * xtensa-tdep.c (xtensa_push_dummy_call): Likewise.
2018-11-16 12:21:04 +01:00
if (return_method == return_method_struct)
{
if (arm_debug)
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
fprintf_unfiltered (gdb_stdlog, "struct return in %s = %s\n",
gdbarch_register_name (gdbarch, argreg),
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
paddress (gdbarch, struct_addr));
regcache_cooked_write_unsigned (regcache, argreg, struct_addr);
argreg++;
}
for (argnum = 0; argnum < nargs; argnum++)
{
int len;
struct type *arg_type;
struct type *target_type;
enum type_code typecode;
const bfd_byte *val;
int align;
enum arm_vfp_cprc_base_type vfp_base_type;
int vfp_base_count;
int may_use_core_reg = 1;
arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type);
target_type = TYPE_TARGET_TYPE (arg_type);
typecode = arg_type->code ();
val = value_contents (args[argnum]);
align = type_align (arg_type);
/* Round alignment up to a whole number of words. */
align = (align + ARM_INT_REGISTER_SIZE - 1)
& ~(ARM_INT_REGISTER_SIZE - 1);
/* Different ABIs have different maximum alignments. */
if (gdbarch_tdep (gdbarch)->arm_abi == ARM_ABI_APCS)
{
/* The APCS ABI only requires word alignment. */
align = ARM_INT_REGISTER_SIZE;
}
else
{
/* The AAPCS requires at most doubleword alignment. */
if (align > ARM_INT_REGISTER_SIZE * 2)
align = ARM_INT_REGISTER_SIZE * 2;
}
if (use_vfp_abi
&& arm_vfp_call_candidate (arg_type, &vfp_base_type,
&vfp_base_count))
{
int regno;
int unit_length;
int shift;
unsigned mask;
/* Because this is a CPRC it cannot go in a core register or
cause a core register to be skipped for alignment.
Either it goes in VFP registers and the rest of this loop
iteration is skipped for this argument, or it goes on the
stack (and the stack alignment code is correct for this
case). */
may_use_core_reg = 0;
unit_length = arm_vfp_cprc_unit_length (vfp_base_type);
shift = unit_length / 4;
mask = (1 << (shift * vfp_base_count)) - 1;
for (regno = 0; regno < 16; regno += shift)
if (((vfp_regs_free >> regno) & mask) == mask)
break;
if (regno < 16)
{
int reg_char;
int reg_scaled;
int i;
vfp_regs_free &= ~(mask << regno);
reg_scaled = regno / shift;
reg_char = arm_vfp_cprc_reg_char (vfp_base_type);
for (i = 0; i < vfp_base_count; i++)
{
char name_buf[4];
int regnum;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
if (reg_char == 'q')
arm_neon_quad_write (gdbarch, regcache, reg_scaled + i,
val + i * unit_length);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
else
{
xsnprintf (name_buf, sizeof (name_buf), "%c%d",
reg_char, reg_scaled + i);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
regcache->cooked_write (regnum, val + i * unit_length);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
}
}
continue;
}
else
{
/* This CPRC could not go in VFP registers, so all VFP
registers are now marked as used. */
vfp_regs_free = 0;
}
}
[gdb] Fix more typos in comments Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
/* Push stack padding for doubleword alignment. */
if (nstack & (align - 1))
{
si = push_stack_item (si, val, ARM_INT_REGISTER_SIZE);
nstack += ARM_INT_REGISTER_SIZE;
}
/* Doubleword aligned quantities must go in even register pairs. */
if (may_use_core_reg
&& argreg <= ARM_LAST_ARG_REGNUM
&& align > ARM_INT_REGISTER_SIZE
&& argreg & 1)
argreg++;
/* If the argument is a pointer to a function, and it is a
Thumb function, create a LOCAL copy of the value and set
the THUMB bit in it. */
if (TYPE_CODE_PTR == typecode
&& target_type != NULL
&& TYPE_CODE_FUNC == check_typedef (target_type)->code ())
{
* 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 19:25:59 +02:00
CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
if (arm_pc_is_thumb (gdbarch, regval))
{
Add casts to memory allocation related calls Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-09-25 20:08:06 +02:00
bfd_byte *copy = (bfd_byte *) alloca (len);
store_unsigned_integer (copy, len, byte_order,
* 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 19:25:59 +02:00
MAKE_THUMB_ADDR (regval));
val = copy;
}
}
/* Copy the argument to general registers or the stack in
register-sized pieces. Large arguments are split between
registers and stack. */
while (len > 0)
{
int partial_len = len < ARM_INT_REGISTER_SIZE
? len : ARM_INT_REGISTER_SIZE;
CORE_ADDR regval
= extract_unsigned_integer (val, partial_len, byte_order);
if (may_use_core_reg && argreg <= ARM_LAST_ARG_REGNUM)
{
/* The argument is being passed in a general purpose
register. */
* 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 19:25:59 +02:00
if (byte_order == BFD_ENDIAN_BIG)
regval <<= (ARM_INT_REGISTER_SIZE - partial_len) * 8;
if (arm_debug)
fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n",
2007-06-09 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (REGISTER_NAME): Replace by gdbarch_register_name. * tracepoint.c (scope_info): Likewise. * target.c (debug_print_register): Likewise. * stack.c (frame_info): Likewise. * sh-tdep.c (sh_register_reggroup_p): Likewise. * sh64-tdep.c (sh64_do_fp_register, sh64_do_register) (sh64_media_print_registers_info) (sh64_compact_print_registers_info): Likewise. * rs6000-tdep.c (rs6000_register_reggroup_p): Likewise. * remote-sim.c (gdbsim_fetch_register): Likewise. * remote.c (packet_reg): Likewise (comment). * reggroups.c (default_register_reggroup_p): Likewise. * regcache.c (regcache_dump): Likewise. * printcmd.c (address_info): Likewise. * ppc-linux-nat.c (fetch_register, store_register): Likewise. * mt-dep.c (mt_registers_info): Likewise. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Likewise (comment). * mips-tdep.c (mips_register_reggroup_p, mips_read_fp_register_single) (mips_read_fp_register_double, mips_print_fp_register) (mips_print_register, print_gp_register_row, mips_print_registers_info) (mips_register_sim_regno): Likewise. * m68klinux-nat.c (regmap, fetch_register, store_register): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register) (inf_ptrace_store_register): Likewise. * infcmd.c (default_print_registers_info): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_register) (ia64_linux_store_register): Likewise. * i386-linux-nat.c (fetch_register, store_register): Likewise. * i386gnu-nat.c (gnu_fetch_registers, gnu_store_registers): Likewise. * hppa-linux-nat.c (fetch_register, store_register): Likewise. * hppa-hpux-nat.c (hppa_hpux_fetch_register) (hppa_hpux_store_register): Likewise. * findvar.c (locate_var_value): Likewise. * dwarf2loc.c (locexpr_describe_location): Likewise. * dwarf2-frame.c (execute_cfa_program): Likewise. * arm-tdep.c (arm_push_dummy_call): Likewise. * arch-utils.c (legacy_register_sim_regno): Likewise. * alpha-tdep.c (alpha_register_reggroup_p): Likewise. * alpha-nat.c (fetch_osf_core_registers): Likewise. * mi/mi-main.c (mi_cmd_data_list_register_names) (mi_cmd_data_list_changed_registers, mi_cmd_data_list_register_values) (mi_cmd_data_write_register_values): Likewise. * gdbarch.c, gdbarch.h: Regenerate.
2007-06-09 15:42:16 +02:00
argnum,
gdbarch_register_name
(gdbarch, argreg),
phex (regval, ARM_INT_REGISTER_SIZE));
regcache_cooked_write_unsigned (regcache, argreg, regval);
argreg++;
}
else
{
gdb_byte buf[ARM_INT_REGISTER_SIZE];
memset (buf, 0, sizeof (buf));
store_unsigned_integer (buf, partial_len, byte_order, regval);
/* Push the arguments onto the stack. */
if (arm_debug)
fprintf_unfiltered (gdb_stdlog, "arg %d @ sp + %d\n",
argnum, nstack);
si = push_stack_item (si, buf, ARM_INT_REGISTER_SIZE);
nstack += ARM_INT_REGISTER_SIZE;
}
len -= partial_len;
val += partial_len;
}
}
/* If we have an odd number of words to push, then decrement the stack
by one word now, so first stack argument will be dword aligned. */
if (nstack & 4)
sp -= 4;
while (si)
{
sp -= si->len;
write_memory (sp, si->data, si->len);
si = pop_stack_item (si);
}
/* Finally, update teh SP register. */
regcache_cooked_write_unsigned (regcache, ARM_SP_REGNUM, sp);
return sp;
}
/* Always align the frame to an 8-byte boundary. This is required on
some platforms and harmless on the rest. */
static CORE_ADDR
arm_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
{
/* Align the stack to eight bytes. */
return sp & ~ (CORE_ADDR) 7;
}
static void
print_fpu_flags (struct ui_file *file, int flags)
{
1999-07-07 22:19:36 +02:00
if (flags & (1 << 0))
fputs_filtered ("IVO ", file);
1999-07-07 22:19:36 +02:00
if (flags & (1 << 1))
fputs_filtered ("DVZ ", file);
1999-07-07 22:19:36 +02:00
if (flags & (1 << 2))
fputs_filtered ("OFL ", file);
1999-07-07 22:19:36 +02:00
if (flags & (1 << 3))
fputs_filtered ("UFL ", file);
1999-07-07 22:19:36 +02:00
if (flags & (1 << 4))
fputs_filtered ("INX ", file);
fputc_filtered ('\n', file);
}
/* Print interesting information about the floating point processor
(if present) or emulator. */
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
static void
arm_print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
struct frame_info *frame, const char *args)
{
* arm-tdep.c (arm_print_float_info): Use register value from FRAME instead of calling read_register. * avr-tdep.c (avr_push_dummy_call): Write to REGCACHE instead of calling write_register. * hppa-tdep.c (hppa32_push_dummy_call): Write to REGCACHE instead of calling write_register. * ia64-tdep.c (find_func_descr): Add REGCACHE parameter. Use it instead of calling read_register. (ia64_push_dummy_call): Update call to find_func_descr. Use REGCACHE instead of calling read_register and write_register. * m32r-tdep.c (m32r_linux_supply_gregset): Use REGCACHE parameter instead of current_regcache. * mn10300-tdep.c (mn10300_push_dummy_call): Write to REGCACHE instead of calling write_register. * mn10300-linux-tdep.c (am33_supply_fpregset_method): Use REGCACHE parameter instead of current_regcache. * mips-tdep.c (mips2_fp_compat): Add FRAME parameter. Use it instead of calling read_register. (mips_read_fp_register_double, mips_print_fp_register): Update calls. (mips_eabi_push_dummy_call): Use REGCACHE instead of write_register. (mips_n32n64_push_dummy_call): Likewise. (mips_o32_push_dummy_call): Likewise. (mips_o64_push_dummy_call): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Use REGCACHE parameter instead of current_regcache. * xtensa-tdep.c (xtensa_register_write_masked): Add REGCACHE parameter. Use it instead of read_register and write_register. (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Update call. (xtensa_pseudo_register_write): Likewise. (xtensa_frame_cache): Use register values unwound from NEXT_FRAME instead of calling read_register. (xtensa_push_dummy_call): Update comment.
2007-06-16 00:34:13 +02:00
unsigned long status = get_frame_register_unsigned (frame, ARM_FPS_REGNUM);
1999-07-07 22:19:36 +02:00
int type;
type = (status >> 24) & 127;
if (status & (1 << 31))
fprintf_filtered (file, _("Hardware FPU type %d\n"), type);
else
fprintf_filtered (file, _("Software FPU type %d\n"), type);
/* i18n: [floating point unit] mask */
fputs_filtered (_("mask: "), file);
print_fpu_flags (file, status >> 16);
/* i18n: [floating point unit] flags */
fputs_filtered (_("flags: "), file);
print_fpu_flags (file, status);
}
* gdbtypes.h (builtin_type_ieee_single, builtin_type_ieee_double, builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (init_float_type, init_complex_type): Add prototypes. * gdbtypes.c (builtin_type_ieee_single, builtin_type_ieee_double, builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (_initialize_gdbtypes): Do not initialize them. (build_flt): Rename to ... (init_float_type): ... this. Make global. (build_complex): Rename to ... (init_complex_type): ... this. Make global. Remove BIT argument. (gdbtypes_post_init): Update calls. * ada-lang.c (ada_language_arch_info): Use init_float_type. * jv-lang.c (build_java_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * f-lang.c (build_fortran_types): Use init_float_type and init_complex_type. * target-descriptions.c (tdesc_gdb_type): Call init_float_type instead of using builtin_type_ieee_single, builtin_type_ieee_double, or builtin_type_arm_ext. * ia64-tdep.h (struct gdbarch_tdep): Add ia64_ext_type member. * ia64-tdep.c (builtin_type_ia64_ext): Remove. (_initialize_ia64_tdep): Do not initialize it. (floatformat_valid, floatformat_ia64_ext, floatformats_ia64_ext): Move up. (ia64_ext_type): New function. (ia64_register_reggroup_p, ia64_convert_register_p, ia64_register_to_value, ia64_value_to_register, ia64_extract_return_value, ia64_store_return_value): Use ia64_ext_type instead of builtin_type_ia64_ext. * i386-tdep.h (struct gdbarch_tdep): Add i387_ext_type member. (i387_ext_type): Add prototype. * i386-tdep.c (i387_ext_type): New function. (i386_extract_return_value, i386_store_return_value, i386_register_type): Use it instead of builtin_type_i387_ext. * amd64-tdep.c (amd64_register_type): Likewise. * i387-tdep.c (print_i387_value, i387_register_to_value, i387_value_to_register): Likewise. (print_i387_value, print_i387_ext): Add GDBARCH argument. (print_i387_ext, i387_print_float_info): Pass to subroutines. * m68k-tdep.h (struct gdbarch_tdep): Add m68881_ext_type member. * m68k-tdep.c (m68881_ext_type): New function. (m68k_register_type, m68k_convert_register_p): Use it instead of builtin_type_m68881_ext. * arm-tdep.h (struct gdbarch_tdep): Add arm_ext_type member. * arm-tdep.c (arm_ext_type): New function. (arm_register_type): Use it instead of builtin_type_arm_ext. * alpha-tdep.c (alpha_register_type): Use builtin types instead of builtin_type_ieee_double. * mips-tdep.c (mips_float_register_type, mips_double_register_type): Remove. (mips_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double. (mips_print_fp_register): Use builtin types instead of mips_float_register_type and mips_double_register_type. * hppa-tdep.c (hppa32_register_type, hppa64_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double.
2009-07-02 14:48:54 +02:00
/* Construct the ARM extended floating point type. */
static struct type *
arm_ext_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (!tdep->arm_ext_type)
tdep->arm_ext_type
* gdbtypes.h (TYPE_OBJFILE_OWNED, TYPE_OWNER): New macros. (TYPE_OBJFILE, TYPE_ALLOC, TYPE_ZALLOC): Reimplement. (alloc_type_arch): Add prototype. (alloc_type_copy): Likewise. (get_type_arch): Likewise. (arch_type): Likewise. (arch_integer_type): Likewise. (arch_character_type): Likewise. (arch_boolean_type): Likewise. (init_float_type): Remove, replace by ... (arch_float_type): ... this. (init_complex_type): Remove, replace by ... (arch_complex_type): ... this. (init_flags_type): Remove, replace by ... (arch_flags_type): ... this. (init_composite_type): Remove, replace by ... (arch_composite_type): ... this. * gdbtypes.c (alloc_type): No longer support NULL objfile. (init_type): Likewise. (alloc_type_arch): New function. (alloc_type_copy): New function. (get_type_arch): New function. (smash_type): Preserve type ownership information. (make_pointer_type, make_reference_type, make_function_type, smash_to_memberptr_type, smash_to_method_type): No longer preserve OBJFILE across smash_type calls. (make_pointer_type, make_reference_type, make_function_type, lookup_memberptr_type, lookup_methodptr_type, allocate_stub_method, create_range_type, create_array_type, create_set_type, copy_type): Use alloc_type_copy when allocating types. (check_typedef): Use alloc_type_arch. (copy_type_recursive): Likewise. Preserve type ownership data after copying type. (recursive_dump_type): Dump type ownership data. (alloc_type_instance): Update type ownership check. (copy_type, copy_type_recursive): Likewise. (arch_type): New function. (arch_integer_type): Likewise. (arch_character_type): Likewise. (arch_boolean_type): Likewise. (init_float_type): Remove, replace by ... (arch_float_type): ... this. (init_complex_type): Remove, replace by ... (arch_complex_type): ... this. (init_flags_type): Remove, replace by ... (arch_flags_type): ... this. (append_flags_type_flag): Move down. (init_composite_type): Remove, replace by ... (arch_composite_type): ... this. (append_composite_type_field_aligned, append_composite_type_field): Move down. * gdbarch.c (gdbtypes_post_init): Allocate all types using per-architecture routines. * ada-lang.c (ada_language_arch_info): Likewise. * f-lang.c (build_fortran_types): Likewise. * jv-lang.c (build_java_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * scm-lang.c (build_scm_types): Likewise. * ada-lang.c (ada_type_of_array): Use alloc_type_copy. (packed_array_type): Likewise. (ada_template_to_fixed_record_type_1): Likewise. (template_to_static_fixed_type): Likewise. (to_record_with_fixed_variant_part): Likewise. (to_fixed_variant_branch_type): Likewise. (to_fixed_array_type): Likewise. (to_fixed_range_type): Likewise. (empty_record): Use type instead of objfile argument. Use alloc_type_copy. (to_fixed_variant_branch_type): Update call to empty_record. * jv-lang.c (type_from_class): Use alloc_type_arch. * arm-tdep.c (arm_ext_type): Allocate per-architecture type. * i386-tdep.c (i386_eflags_type, i386_mxcsr_type, i387_ext_type, i386_mmx_type, i386_sse_type): Likewise. * ia64-tdep.c (ia64_ext_type): Likewise. * m32c-tdep.c (make_types): Likewise. * m68k-tdep.c (m68k_ps_type, m68881_ext_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64, rs6000_builtin_type_vec128): Likewise. * sparc-tdep.c (sparc_psr_type, sparc_fsr_type): Likewise. * sparc64-tdep.c (sparc64_pstate_type, sparc64_fsr_type, sparc64_fprs_type): Likewise. * spu-tdep.c (spu_builtin_type_vec128): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * linux-tdep.c (linux_get_siginfo_type): Likewise. * target-descriptions.c (tdesc_gdb_type): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise.
2009-07-02 14:55:30 +02:00
= arch_float_type (gdbarch, -1, "builtin_type_arm_ext",
* gdbtypes.h (builtin_type_ieee_single, builtin_type_ieee_double, builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (init_float_type, init_complex_type): Add prototypes. * gdbtypes.c (builtin_type_ieee_single, builtin_type_ieee_double, builtin_type_i387_ext, builtin_type_m68881_ext, builtin_type_arm_ext, builtin_type_ia64_spill, builtin_type_ia64_quad): Remove. (_initialize_gdbtypes): Do not initialize them. (build_flt): Rename to ... (init_float_type): ... this. Make global. (build_complex): Rename to ... (init_complex_type): ... this. Make global. Remove BIT argument. (gdbtypes_post_init): Update calls. * ada-lang.c (ada_language_arch_info): Use init_float_type. * jv-lang.c (build_java_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * f-lang.c (build_fortran_types): Use init_float_type and init_complex_type. * target-descriptions.c (tdesc_gdb_type): Call init_float_type instead of using builtin_type_ieee_single, builtin_type_ieee_double, or builtin_type_arm_ext. * ia64-tdep.h (struct gdbarch_tdep): Add ia64_ext_type member. * ia64-tdep.c (builtin_type_ia64_ext): Remove. (_initialize_ia64_tdep): Do not initialize it. (floatformat_valid, floatformat_ia64_ext, floatformats_ia64_ext): Move up. (ia64_ext_type): New function. (ia64_register_reggroup_p, ia64_convert_register_p, ia64_register_to_value, ia64_value_to_register, ia64_extract_return_value, ia64_store_return_value): Use ia64_ext_type instead of builtin_type_ia64_ext. * i386-tdep.h (struct gdbarch_tdep): Add i387_ext_type member. (i387_ext_type): Add prototype. * i386-tdep.c (i387_ext_type): New function. (i386_extract_return_value, i386_store_return_value, i386_register_type): Use it instead of builtin_type_i387_ext. * amd64-tdep.c (amd64_register_type): Likewise. * i387-tdep.c (print_i387_value, i387_register_to_value, i387_value_to_register): Likewise. (print_i387_value, print_i387_ext): Add GDBARCH argument. (print_i387_ext, i387_print_float_info): Pass to subroutines. * m68k-tdep.h (struct gdbarch_tdep): Add m68881_ext_type member. * m68k-tdep.c (m68881_ext_type): New function. (m68k_register_type, m68k_convert_register_p): Use it instead of builtin_type_m68881_ext. * arm-tdep.h (struct gdbarch_tdep): Add arm_ext_type member. * arm-tdep.c (arm_ext_type): New function. (arm_register_type): Use it instead of builtin_type_arm_ext. * alpha-tdep.c (alpha_register_type): Use builtin types instead of builtin_type_ieee_double. * mips-tdep.c (mips_float_register_type, mips_double_register_type): Remove. (mips_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double. (mips_print_fp_register): Use builtin types instead of mips_float_register_type and mips_double_register_type. * hppa-tdep.c (hppa32_register_type, hppa64_register_type): Use builtin types instead of builtin_type_ieee_single and builtin_type_ieee_double.
2009-07-02 14:48:54 +02:00
floatformats_arm_ext);
return tdep->arm_ext_type;
}
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
static struct type *
arm_neon_double_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (tdep->neon_double_type == NULL)
{
struct type *t, *elem;
t = arch_composite_type (gdbarch, "__gdb_builtin_type_neon_d",
TYPE_CODE_UNION);
elem = builtin_type (gdbarch)->builtin_uint8;
append_composite_type_field (t, "u8", init_vector_type (elem, 8));
elem = builtin_type (gdbarch)->builtin_uint16;
append_composite_type_field (t, "u16", init_vector_type (elem, 4));
elem = builtin_type (gdbarch)->builtin_uint32;
append_composite_type_field (t, "u32", init_vector_type (elem, 2));
elem = builtin_type (gdbarch)->builtin_uint64;
append_composite_type_field (t, "u64", elem);
elem = builtin_type (gdbarch)->builtin_float;
append_composite_type_field (t, "f32", init_vector_type (elem, 2));
elem = builtin_type (gdbarch)->builtin_double;
append_composite_type_field (t, "f64", elem);
TYPE_VECTOR (t) = 1;
t->set_name ("neon_d");
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
tdep->neon_double_type = t;
}
return tdep->neon_double_type;
}
/* FIXME: The vector types are not correctly ordered on big-endian
targets. Just as s0 is the low bits of d0, d0[0] is also the low
bits of d0 - regardless of what unit size is being held in d0. So
the offset of the first uint8 in d0 is 7, but the offset of the
first float is 4. This code works as-is for little-endian
targets. */
static struct type *
arm_neon_quad_type (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (tdep->neon_quad_type == NULL)
{
struct type *t, *elem;
t = arch_composite_type (gdbarch, "__gdb_builtin_type_neon_q",
TYPE_CODE_UNION);
elem = builtin_type (gdbarch)->builtin_uint8;
append_composite_type_field (t, "u8", init_vector_type (elem, 16));
elem = builtin_type (gdbarch)->builtin_uint16;
append_composite_type_field (t, "u16", init_vector_type (elem, 8));
elem = builtin_type (gdbarch)->builtin_uint32;
append_composite_type_field (t, "u32", init_vector_type (elem, 4));
elem = builtin_type (gdbarch)->builtin_uint64;
append_composite_type_field (t, "u64", init_vector_type (elem, 2));
elem = builtin_type (gdbarch)->builtin_float;
append_composite_type_field (t, "f32", init_vector_type (elem, 4));
elem = builtin_type (gdbarch)->builtin_double;
append_composite_type_field (t, "f64", init_vector_type (elem, 2));
TYPE_VECTOR (t) = 1;
t->set_name ("neon_q");
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
tdep->neon_quad_type = t;
}
return tdep->neon_quad_type;
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* Return the GDB type object for the "standard" data type of data in
register N. */
static struct type *
arm_register_type (struct gdbarch *gdbarch, int regnum)
{
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
int num_regs = gdbarch_num_regs (gdbarch);
if (gdbarch_tdep (gdbarch)->have_vfp_pseudos
&& regnum >= num_regs && regnum < num_regs + 32)
return builtin_type (gdbarch)->builtin_float;
if (gdbarch_tdep (gdbarch)->have_neon_pseudos
&& regnum >= num_regs + 32 && regnum < num_regs + 32 + 16)
return arm_neon_quad_type (gdbarch);
/* If the target description has register information, we are only
in this function so that we can override the types of
double-precision registers for NEON. */
if (tdesc_has_registers (gdbarch_target_desc (gdbarch)))
{
struct type *t = tdesc_register_type (gdbarch, regnum);
if (regnum >= ARM_D0_REGNUM && regnum < ARM_D0_REGNUM + 32
&& t->code () == TYPE_CODE_FLT
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
&& gdbarch_tdep (gdbarch)->have_neon)
return arm_neon_double_type (gdbarch);
else
return t;
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
if (regnum >= ARM_F0_REGNUM && regnum < ARM_F0_REGNUM + NUM_FREGS)
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
{
if (!gdbarch_tdep (gdbarch)->have_fpa_registers)
return builtin_type (gdbarch)->builtin_void;
return arm_ext_type (gdbarch);
}
else if (regnum == ARM_SP_REGNUM)
* alpha-tdep.c (alpha_register_type): Use builtin_type (gdbarch) instead of builtin_type_ macros. * amd64-tdep.c (amd64_register_type): Likewise. (amd64_get_longjmp_target): Likewise. * arm-tdep.c (arm_register_type): Likewise. * avr-tdep.c (avr_register_type): Likewise. * cris-tdep.c (cris_register_type, crisv32_register_type): Likewise. * frv-tdep.c (frv_register_type): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * hppa-tdep.c (hppa32_convert_from_func_ptr_addr, hppa_skip_trampoline_code): Likewise. * i386-tdep.c (i386_register_type): Likewise. (i386_unwind_pc, i386_sse_type): Likewise. * ia64-tdep.c (ia64_register_type): Likewise. * m32r-tdep.c (m32r_register_type): Likewise. * m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise. * m88k-tdep.c (m88k_register_type): Likewise. * mep-tdep.c (mep_register_type): Likewise. * mips-tdep.c (mips_pseudo_register_type): Likewise. * mn10300-tdep.c (mn10300_register_type): Likewise. * mt-tdep.c (mt_copro_register_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64): Likewise. (rs6000_convert_register_p, rs6000_register_to_value, rs6000_value_to_register): Likewise. * s390-tdep.c (s390_register_type): Likewise. * sh64-tdep.c (sh64_register_type): Likewise. (sh64_build_float_register_type, sh64_do_fp_register): Likewise. * sh-tdep.c (sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_build_float_register_type, sh_sh4_register_type, sh_default_register_type): Likewise. * sparc64-tdep.c (sparc64_register_type): Likewise. * sparc-tdep.c (sparc32_register_type): Likewise. * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise. * v850-tdep.c (v850_register_type): Likewise. * vax-tdep.c (vax_register_type): Likewise. * xtensa-tdep.c (xtensa_register_type, xtensa_unwind_pc, xtensa_push_dummy_call): Likewise. * std-regs.c (value_of_builtin_frame_fp_reg, value_of_builtin_frame_pc_reg): Likewise. * target-descriptions.c (tdesc_register_type): Likewise.
2008-09-11 16:23:15 +02:00
return builtin_type (gdbarch)->builtin_data_ptr;
else if (regnum == ARM_PC_REGNUM)
* alpha-tdep.c (alpha_register_type): Use builtin_type (gdbarch) instead of builtin_type_ macros. * amd64-tdep.c (amd64_register_type): Likewise. (amd64_get_longjmp_target): Likewise. * arm-tdep.c (arm_register_type): Likewise. * avr-tdep.c (avr_register_type): Likewise. * cris-tdep.c (cris_register_type, crisv32_register_type): Likewise. * frv-tdep.c (frv_register_type): Likewise. * h8300-tdep.c (h8300_register_type): Likewise. * hppa-tdep.c (hppa32_convert_from_func_ptr_addr, hppa_skip_trampoline_code): Likewise. * i386-tdep.c (i386_register_type): Likewise. (i386_unwind_pc, i386_sse_type): Likewise. * ia64-tdep.c (ia64_register_type): Likewise. * m32r-tdep.c (m32r_register_type): Likewise. * m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise. * m88k-tdep.c (m88k_register_type): Likewise. * mep-tdep.c (mep_register_type): Likewise. * mips-tdep.c (mips_pseudo_register_type): Likewise. * mn10300-tdep.c (mn10300_register_type): Likewise. * mt-tdep.c (mt_copro_register_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64): Likewise. (rs6000_convert_register_p, rs6000_register_to_value, rs6000_value_to_register): Likewise. * s390-tdep.c (s390_register_type): Likewise. * sh64-tdep.c (sh64_register_type): Likewise. (sh64_build_float_register_type, sh64_do_fp_register): Likewise. * sh-tdep.c (sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_build_float_register_type, sh_sh4_register_type, sh_default_register_type): Likewise. * sparc64-tdep.c (sparc64_register_type): Likewise. * sparc-tdep.c (sparc32_register_type): Likewise. * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise. * v850-tdep.c (v850_register_type): Likewise. * vax-tdep.c (vax_register_type): Likewise. * xtensa-tdep.c (xtensa_register_type, xtensa_unwind_pc, xtensa_push_dummy_call): Likewise. * std-regs.c (value_of_builtin_frame_fp_reg, value_of_builtin_frame_pc_reg): Likewise. * target-descriptions.c (tdesc_register_type): Likewise.
2008-09-11 16:23:15 +02:00
return builtin_type (gdbarch)->builtin_func_ptr;
else if (regnum >= ARRAY_SIZE (arm_register_names))
/* These registers are only supported on targets which supply
an XML description. */
* gdbtypes.h (builtin_type_int0, builtin_type_int8, builtin_type_uint8, builtin_type_int16, builtin_type_uint16, builtin_type_int32, builtin_type_uint32, builtin_type_int64, builtin_type_uint64, builtin_type_int128, builtin_type_uint128): Remove. (struct builtin_type): New members builtin_int0, builtin_int8, builtin_uint8, builtin_int16, builtin_uint16, builtin_int32, builtin_uint32, builtin_int64, builtin_uint64, builtin_int128, and builtin_uint128. * gdbtypes.c (builtin_type_int0, builtin_type_int8, builtin_type_uint8, builtin_type_int16, builtin_type_uint16, builtin_type_int32, builtin_type_uint32, builtin_type_int64, builtin_type_uint64, builtin_type_int128, builtin_type_uint128): Remove. (_initialize_gdbtypes): Do not initialize them. (gdbtypes_post_init): Initialize fixed-size integer types. * dwarf2expr.c (unsigned_address_type, signed_address_type): Add GDBARCH argument. Return platform-specific type. (dwarf2_read_address, execute_stack_op): Update calls. * target-descriptions.c (tdesc_gdb_type): Use platform-specific types instead of global builtin_int_... variables. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. * printcmd.c (do_examine): Likewise. * jv-exp.y (parse_number): Likewise. * alpha-tdep.c (alpha_register_type, alpha_push_dummy_call, alpha_store_return_value): Likewise. * amd64-linux-tdep.c (amd64_linux_register_type): Likewise. * amd64-tdep.c (amd64_register_type): Likewise. * arm-tdep.c (arm_register_type): Likewise. * avr-tdep.c (avr_register_type): Likewise. * cris-tdep.c (cris_register_type, crisv32_register_type): Likewise. * frv-tdep.c (frv_register_type): Likewise. * h8300-tdep.c h8300_register_type): Likewise. * hppa-tdep.c (hppa64_push_dummy_call, hppa32_register_type, hppa64_register_type): Likewise. * i386-tdep.c (i386_mmx_type, i386_sse_type): Likewise. * iq2000-tdep.c (iq2000_register_type): Likewise. * lm32-tdep.c (lm32_register_type, lm32_push_dummy_call): Likewise. * m32r-tdep.c (m32r_register_type): Likewise. * m68hc11-tdep.c (m68hc11_register_type, m68hc11_pseudo_register_read, m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_register_type): Likewise. * m88k-tdep.c (m88k_register_type, m88k_store_arguments): Likewise. * mep-tdep.c (mep_register_type): Likewise. * mips-tdep.c (mips_register_type, mips_pseudo_register_type, mips_print_fp_register): Likewise. * moxie-tdep.c (moxie_register_type): Likewise. * mt-tdep.c (mt_copro_register_type, mt_register_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64, rs6000_builtin_type_vec128): Likewise. * score-tdep.c (score_register_type): Likewise. * sparc-tdep.c (sparc32_register_type, sparc32_store_arguments): Likewise. * sparc64-tdep.c (sparc64_register_type, sparc64_store_arguments): Likewise. * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise. * v850-tdep.c (v850_register_type): Likewise. * xstormy16-tdep.c (xstormy16_register_type): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * mt-tdep.c (struct gdbarch_tdep): New data structure. (mt_gdbarch_init): Alloc TDEP structures. (mt_register_type): Cache coprocessor type in TDEP instead of static global variable. * xtensa-tdep.h (struct gdbarch_tdep): Add type_entries member. * xtensa-tdep.c (type_entries): Remove. (xtensa_register_type): Cache fixed-size types in TDEP instead of in global variable.
2009-07-02 14:46:19 +02:00
return builtin_type (gdbarch)->builtin_int0;
else
* gdbtypes.h (builtin_type_int0, builtin_type_int8, builtin_type_uint8, builtin_type_int16, builtin_type_uint16, builtin_type_int32, builtin_type_uint32, builtin_type_int64, builtin_type_uint64, builtin_type_int128, builtin_type_uint128): Remove. (struct builtin_type): New members builtin_int0, builtin_int8, builtin_uint8, builtin_int16, builtin_uint16, builtin_int32, builtin_uint32, builtin_int64, builtin_uint64, builtin_int128, and builtin_uint128. * gdbtypes.c (builtin_type_int0, builtin_type_int8, builtin_type_uint8, builtin_type_int16, builtin_type_uint16, builtin_type_int32, builtin_type_uint32, builtin_type_int64, builtin_type_uint64, builtin_type_int128, builtin_type_uint128): Remove. (_initialize_gdbtypes): Do not initialize them. (gdbtypes_post_init): Initialize fixed-size integer types. * dwarf2expr.c (unsigned_address_type, signed_address_type): Add GDBARCH argument. Return platform-specific type. (dwarf2_read_address, execute_stack_op): Update calls. * target-descriptions.c (tdesc_gdb_type): Use platform-specific types instead of global builtin_int_... variables. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. * printcmd.c (do_examine): Likewise. * jv-exp.y (parse_number): Likewise. * alpha-tdep.c (alpha_register_type, alpha_push_dummy_call, alpha_store_return_value): Likewise. * amd64-linux-tdep.c (amd64_linux_register_type): Likewise. * amd64-tdep.c (amd64_register_type): Likewise. * arm-tdep.c (arm_register_type): Likewise. * avr-tdep.c (avr_register_type): Likewise. * cris-tdep.c (cris_register_type, crisv32_register_type): Likewise. * frv-tdep.c (frv_register_type): Likewise. * h8300-tdep.c h8300_register_type): Likewise. * hppa-tdep.c (hppa64_push_dummy_call, hppa32_register_type, hppa64_register_type): Likewise. * i386-tdep.c (i386_mmx_type, i386_sse_type): Likewise. * iq2000-tdep.c (iq2000_register_type): Likewise. * lm32-tdep.c (lm32_register_type, lm32_push_dummy_call): Likewise. * m32r-tdep.c (m32r_register_type): Likewise. * m68hc11-tdep.c (m68hc11_register_type, m68hc11_pseudo_register_read, m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_register_type): Likewise. * m88k-tdep.c (m88k_register_type, m88k_store_arguments): Likewise. * mep-tdep.c (mep_register_type): Likewise. * mips-tdep.c (mips_register_type, mips_pseudo_register_type, mips_print_fp_register): Likewise. * moxie-tdep.c (moxie_register_type): Likewise. * mt-tdep.c (mt_copro_register_type, mt_register_type): Likewise. * rs6000-tdep.c (rs6000_builtin_type_vec64, rs6000_builtin_type_vec128): Likewise. * score-tdep.c (score_register_type): Likewise. * sparc-tdep.c (sparc32_register_type, sparc32_store_arguments): Likewise. * sparc64-tdep.c (sparc64_register_type, sparc64_store_arguments): Likewise. * spu-tdep.c (spu_builtin_type_vec128, spu_register_type): Likewise. * v850-tdep.c (v850_register_type): Likewise. * xstormy16-tdep.c (xstormy16_register_type): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * mt-tdep.c (struct gdbarch_tdep): New data structure. (mt_gdbarch_init): Alloc TDEP structures. (mt_register_type): Cache coprocessor type in TDEP instead of static global variable. * xtensa-tdep.h (struct gdbarch_tdep): Add type_entries member. * xtensa-tdep.c (type_entries): Remove. (xtensa_register_type): Cache fixed-size types in TDEP instead of in global variable.
2009-07-02 14:46:19 +02:00
return builtin_type (gdbarch)->builtin_uint32;
}
/* Map a DWARF register REGNUM onto the appropriate GDB register
number. */
static int
arm_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
{
/* Core integer regs. */
if (reg >= 0 && reg <= 15)
return reg;
/* Legacy FPA encoding. These were once used in a way which
overlapped with VFP register numbering, so their use is
discouraged, but GDB doesn't support the ARM toolchain
which used them for VFP. */
if (reg >= 16 && reg <= 23)
return ARM_F0_REGNUM + reg - 16;
/* New assignments for the FPA registers. */
if (reg >= 96 && reg <= 103)
return ARM_F0_REGNUM + reg - 96;
/* WMMX register assignments. */
if (reg >= 104 && reg <= 111)
return ARM_WCGR0_REGNUM + reg - 104;
if (reg >= 112 && reg <= 127)
return ARM_WR0_REGNUM + reg - 112;
if (reg >= 192 && reg <= 199)
return ARM_WC0_REGNUM + reg - 192;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* VFP v2 registers. A double precision value is actually
in d1 rather than s2, but the ABI only defines numbering
for the single precision registers. This will "just work"
in GDB for little endian targets (we'll read eight bytes,
starting in s0 and then progressing to s1), but will be
reversed on big endian targets with VFP. This won't
be a problem for the new Neon quad registers; you're supposed
to use DW_OP_piece for those. */
if (reg >= 64 && reg <= 95)
{
char name_buf[4];
xsnprintf (name_buf, sizeof (name_buf), "s%d", reg - 64);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
return user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
}
/* VFP v3 / Neon registers. This range is also used for VFP v2
registers, except that it now describes d0 instead of s0. */
if (reg >= 256 && reg <= 287)
{
char name_buf[4];
xsnprintf (name_buf, sizeof (name_buf), "d%d", reg - 256);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
return user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
}
return -1;
}
/* Map GDB internal REGNUM onto the Arm simulator register numbers. */
static int
arm_register_sim_regno (struct gdbarch *gdbarch, int regnum)
{
int reg = regnum;
gdb_assert (reg >= 0 && reg < gdbarch_num_regs (gdbarch));
if (regnum >= ARM_WR0_REGNUM && regnum <= ARM_WR15_REGNUM)
return regnum - ARM_WR0_REGNUM + SIM_ARM_IWMMXT_COP0R0_REGNUM;
if (regnum >= ARM_WC0_REGNUM && regnum <= ARM_WC7_REGNUM)
return regnum - ARM_WC0_REGNUM + SIM_ARM_IWMMXT_COP1R0_REGNUM;
if (regnum >= ARM_WCGR0_REGNUM && regnum <= ARM_WCGR7_REGNUM)
return regnum - ARM_WCGR0_REGNUM + SIM_ARM_IWMMXT_COP1R8_REGNUM;
if (reg < NUM_GREGS)
return SIM_ARM_R0_REGNUM + reg;
reg -= NUM_GREGS;
if (reg < NUM_FREGS)
return SIM_ARM_FP0_REGNUM + reg;
reg -= NUM_FREGS;
if (reg < NUM_SREGS)
return SIM_ARM_FPS_REGNUM + reg;
reg -= NUM_SREGS;
internal_error (__FILE__, __LINE__, _("Bad REGNUM %d"), regnum);
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* Given BUF, which is OLD_LEN bytes ending at ENDADDR, expand
the buffer to be NEW_LEN bytes ending at ENDADDR. Return
NULL if an error occurs. BUF is freed. */
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
static gdb_byte *
extend_buffer_earlier (gdb_byte *buf, CORE_ADDR endaddr,
int old_len, int new_len)
{
gdb_byte *new_buf;
int bytes_to_read = new_len - old_len;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
new_buf = (gdb_byte *) xmalloc (new_len);
memcpy (new_buf + bytes_to_read, buf, old_len);
xfree (buf);
if (target_read_code (endaddr - new_len, new_buf, bytes_to_read) != 0)
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
{
xfree (new_buf);
return NULL;
}
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
return new_buf;
}
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* An IT block is at most the 2-byte IT instruction followed by
four 4-byte instructions. The furthest back we must search to
find an IT block that affects the current instruction is thus
2 + 3 * 4 == 14 bytes. */
#define MAX_IT_BLOCK_PREFIX 14
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* Use a quick scan if there are more than this many bytes of
code. */
#define IT_SCAN_THRESHOLD 32
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* Adjust a breakpoint's address to move breakpoints out of IT blocks.
A breakpoint in an IT block may not be hit, depending on the
condition flags. */
static CORE_ADDR
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
{
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
gdb_byte *buf;
char map_type;
CORE_ADDR boundary, func_start;
int buf_len;
enum bfd_endian order = gdbarch_byte_order_for_code (gdbarch);
int i, any, last_it, last_it_count;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* If we are using BKPT breakpoints, none of this is necessary. */
if (gdbarch_tdep (gdbarch)->thumb2_breakpoint == NULL)
return bpaddr;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* ARM mode does not have this problem. */
if (!arm_pc_is_thumb (gdbarch, bpaddr))
return bpaddr;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* We are setting a breakpoint in Thumb code that could potentially
contain an IT block. The first step is to find how much Thumb
code there is; we do not need to read outside of known Thumb
sequences. */
map_type = arm_find_mapping_symbol (bpaddr, &boundary);
if (map_type == 0)
/* Thumb-2 code must have mapping symbols to have a chance. */
return bpaddr;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
bpaddr = gdbarch_addr_bits_remove (gdbarch, bpaddr);
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
if (find_pc_partial_function (bpaddr, NULL, &func_start, NULL)
&& func_start > boundary)
boundary = func_start;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* Search for a candidate IT instruction. We have to do some fancy
footwork to distinguish a real IT instruction from the second
half of a 32-bit instruction, but there is no need for that if
there's no candidate. */
gdb: Use std::min and std::max throughout Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-09-16 20:55:17 +02:00
buf_len = std::min (bpaddr - boundary, (CORE_ADDR) MAX_IT_BLOCK_PREFIX);
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
if (buf_len == 0)
/* No room for an IT instruction. */
return bpaddr;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
buf = (gdb_byte *) xmalloc (buf_len);
if (target_read_code (bpaddr - buf_len, buf, buf_len) != 0)
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
return bpaddr;
any = 0;
for (i = 0; i < buf_len; i += 2)
{
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
unsigned short inst1 = extract_unsigned_integer (&buf[i], 2, order);
if ((inst1 & 0xff00) == 0xbf00 && (inst1 & 0x000f) != 0)
{
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
any = 1;
break;
}
}
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
if (any == 0)
{
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
xfree (buf);
return bpaddr;
}
/* OK, the code bytes before this instruction contain at least one
halfword which resembles an IT instruction. We know that it's
Thumb code, but there are still two possibilities. Either the
halfword really is an IT instruction, or it is the second half of
a 32-bit Thumb instruction. The only way we can tell is to
scan forwards from a known instruction boundary. */
if (bpaddr - boundary > IT_SCAN_THRESHOLD)
{
int definite;
/* There's a lot of code before this instruction. Start with an
optimistic search; it's easy to recognize halfwords that can
not be the start of a 32-bit instruction, and use that to
lock on to the instruction boundaries. */
buf = extend_buffer_earlier (buf, bpaddr, buf_len, IT_SCAN_THRESHOLD);
if (buf == NULL)
return bpaddr;
buf_len = IT_SCAN_THRESHOLD;
definite = 0;
for (i = 0; i < buf_len - sizeof (buf) && ! definite; i += 2)
{
unsigned short inst1 = extract_unsigned_integer (&buf[i], 2, order);
if (thumb_insn_size (inst1) == 2)
{
definite = 1;
break;
}
}
/* At this point, if DEFINITE, BUF[I] is the first place we
are sure that we know the instruction boundaries, and it is far
enough from BPADDR that we could not miss an IT instruction
affecting BPADDR. If ! DEFINITE, give up - start from a
known boundary. */
if (! definite)
{
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
buf = extend_buffer_earlier (buf, bpaddr, buf_len,
bpaddr - boundary);
if (buf == NULL)
return bpaddr;
buf_len = bpaddr - boundary;
i = 0;
}
}
else
{
buf = extend_buffer_earlier (buf, bpaddr, buf_len, bpaddr - boundary);
if (buf == NULL)
return bpaddr;
buf_len = bpaddr - boundary;
i = 0;
}
/* Scan forwards. Find the last IT instruction before BPADDR. */
last_it = -1;
last_it_count = 0;
while (i < buf_len)
{
unsigned short inst1 = extract_unsigned_integer (&buf[i], 2, order);
last_it_count--;
if ((inst1 & 0xff00) == 0xbf00 && (inst1 & 0x000f) != 0)
{
last_it = i;
if (inst1 & 0x0001)
last_it_count = 4;
else if (inst1 & 0x0002)
last_it_count = 3;
else if (inst1 & 0x0004)
last_it_count = 2;
else
last_it_count = 1;
}
i += thumb_insn_size (inst1);
}
xfree (buf);
if (last_it == -1)
/* There wasn't really an IT instruction after all. */
return bpaddr;
if (last_it_count < 1)
/* It was too far away. */
return bpaddr;
/* This really is a trouble spot. Move the breakpoint to the IT
instruction. */
return bpaddr - buf_len + last_it;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* ARM displaced stepping support.
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Generally ARM displaced stepping works as follows:
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
1. When an instruction is to be single-stepped, it is first decoded by
arm_process_displaced_insn. Depending on the type of instruction, it is
then copied to a scratch location, possibly in a modified form. The
copy_* set of functions performs such modification, as necessary. A
breakpoint is placed after the modified instruction in the scratch space
to return control to GDB. Note in particular that instructions which
modify the PC will no longer do so after modification.
1999-07-07 22:19:36 +02:00
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
2. The instruction is single-stepped, by setting the PC to the scratch
location address, and resuming. Control returns to GDB when the
breakpoint is hit.
1999-07-07 22:19:36 +02:00
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
3. A cleanup function (cleanup_*) is called corresponding to the copy_*
function used for the current instruction. This function's job is to
put the CPU/memory state back to what it would have been if the
instruction had been executed unmodified in its original location. */
1999-07-07 22:19:36 +02:00
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* NOP instruction (mov r0, r0). */
#define ARM_NOP 0xe1a00000
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
#define THUMB_NOP 0x4600
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Helper for register reads for displaced stepping. In particular, this
returns the PC as it would be seen by the instruction at its original
location. */
ULONGEST
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
displaced_read_reg (struct regcache *regs, arm_displaced_step_closure *dsc,
int regno)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST ret;
CORE_ADDR from = dsc->insn_addr;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (regno == ARM_PC_REGNUM)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
/* Compute pipeline offset:
- When executing an ARM instruction, PC reads as the address of the
current instruction plus 8.
- When executing a Thumb instruction, PC reads as the address of the
current instruction plus 4. */
if (!dsc->is_thumb)
from += 8;
else
from += 4;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: read pc value %.8lx\n",
(unsigned long) from);
return (ULONGEST) from;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
regcache_cooked_read_unsigned (regs, regno, &ret);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: read r%d value %.8lx\n",
regno, (unsigned long) ret);
return ret;
}
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
static int
displaced_in_arm_mode (struct regcache *regs)
{
ULONGEST ps;
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
ULONGEST t_bit = arm_psr_thumb_bit (regs->arch ());
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &ps);
return (ps & t_bit) == 0;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Write to the PC as from a branch instruction. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
static void
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
branch_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc,
ULONGEST val)
{
if (!dsc->is_thumb)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Note: If bits 0/1 are set, this branch would be unpredictable for
architecture versions < 6. */
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM,
val & ~(ULONGEST) 0x3);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM,
val & ~(ULONGEST) 0x1);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Write to the PC as from a branch-exchange instruction. */
static void
bx_write_pc (struct regcache *regs, ULONGEST val)
{
ULONGEST ps;
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
ULONGEST t_bit = arm_psr_thumb_bit (regs->arch ());
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
regcache_cooked_read_unsigned (regs, ARM_PS_REGNUM, &ps);
if ((val & 1) == 1)
{
regcache_cooked_write_unsigned (regs, ARM_PS_REGNUM, ps | t_bit);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM, val & 0xfffffffe);
}
else if ((val & 2) == 0)
{
regcache_cooked_write_unsigned (regs, ARM_PS_REGNUM, ps & ~t_bit);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM, val);
}
else
{
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Unpredictable behaviour. Try to do something sensible (switch to ARM
mode, align dest to 4 bytes). */
warning (_("Single-stepping BX to non-word-aligned ARM instruction."));
regcache_cooked_write_unsigned (regs, ARM_PS_REGNUM, ps & ~t_bit);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM, val & 0xfffffffc);
}
}
1999-12-22 22:45:38 +01:00
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Write to the PC as if from a load instruction. */
1999-12-22 22:45:38 +01:00
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
static void
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
load_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc,
ULONGEST val)
1999-12-22 22:45:38 +01:00
{
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (DISPLACED_STEPPING_ARCH_VERSION >= 5)
bx_write_pc (regs, val);
else
branch_write_pc (regs, dsc, val);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
* alpha-tdep.c (alpha_heuristic_proc_start) (alpha_sigtramp_register_address): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. (alpha_heuristic_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_heuristic_proc_start call. (alpha_sigtramp_frame_this_id, alpha_sigtramp_frame_prev_register): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_sigtramp_register_address call. * arm-tdep.c (thumb_scan_prologue): Add gdbarch as parameter and replace current_gdbarch by gdbarch. Update caller. (convert_to_extended, convert_from_extended): Add endianess parameter for comparison. Update caller. (arm_extract_return_value, arm_store_return_value): Use get_regcache_arch to get at the current architecture. * cris-tdep.c (cris_register_size): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. (cris_gdb_func, move_to_preg_op, none_reg_mode_move_from_preg_op): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM, E_PSEUDO_EXR_REGNUM, BINWORD): Add gdbarch as parameter. Update caller. (h8300_init_frame_cache): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and update caller. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_trampoline_code): Use get_frame_arch to get at the current architecture. Replace current_gdbarch by gdbarch. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. (STACK_CORRECTION, USE_PAGE_REGISTER): Replace M6811_TDEP by its expression. Add gdbarch as parameter and replace current_gdbarch with it. Update caller. (M6811_TDEP): Remove. (m68hc11_frame_prev_register): Use get_frame_arch to get at the current architecture. (m68hc11_scan_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * m68k-tdep.c (m68k_analyze_prologue): Add gdbarch as parameter and update caller. (m68k_analyze_register_saves): Likewise. Also replace current_gdbarch by gdbarch. * rs6000-tdep.c (skip_prologue): Add gdbarch as parameter and update caller. Relace current_gdbarch by gdbarch. (altivec_register_p, spe_register_p): Likewise. * ppc-tdep.h (altivec_register_p, spe_register_p): Add gdbarch as parameter. * ppc-linux-nat.c (fetch_register, store_register): Update caller of altivec_register_p and spe_register_p. * score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. (score_analyze_prologue): use get_frame_arch to get at the current architecture. * sparc-tdep.h (sparc_analyze_prologue): Add gdbarch as parameter. * sparc-tdep.c (sparc_analyze_prologue): Likewise. Replace current_gdbarch by gdbarch. Update caller. (sparc_frame_cache): Use get_frame_arch to get at the current architecture. * sparce64-tdep.c (sparc64_skip_prologue): Update call of sparc_analyze_prologue. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Add gdbarch as parameter.
2008-01-11 15:43:15 +01:00
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Write to the PC as if from an ALU instruction. */
static void
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
alu_write_pc (struct regcache *regs, arm_displaced_step_closure *dsc,
ULONGEST val)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
if (DISPLACED_STEPPING_ARCH_VERSION >= 7 && !dsc->is_thumb)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
bx_write_pc (regs, val);
else
branch_write_pc (regs, dsc, val);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* Helper for writing to registers for displaced stepping. Writing to the PC
has a varying effects depending on the instruction which does the write:
this is controlled by the WRITE_PC argument. */
void
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
displaced_write_reg (struct regcache *regs, arm_displaced_step_closure *dsc,
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
int regno, ULONGEST val, enum pc_write_style write_pc)
{
if (regno == ARM_PC_REGNUM)
{
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: writing pc %.8lx\n",
(unsigned long) val);
switch (write_pc)
{
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case BRANCH_WRITE_PC:
branch_write_pc (regs, dsc, val);
break;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case BX_WRITE_PC:
bx_write_pc (regs, val);
break;
case LOAD_WRITE_PC:
load_write_pc (regs, dsc, val);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
case ALU_WRITE_PC:
alu_write_pc (regs, dsc, val);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
case CANNOT_WRITE_PC:
warning (_("Instruction wrote to PC in an unexpected way when "
"single-stepping"));
break;
default:
internal_error (__FILE__, __LINE__,
_("Invalid argument to displaced_write_reg"));
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->wrote_to_pc = 1;
}
1999-12-22 22:45:38 +01:00
else
{
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: writing r%d value %.8lx\n",
regno, (unsigned long) val);
regcache_cooked_write_unsigned (regs, regno, val);
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* This function is used to concisely determine if an instruction INSN
references PC. Register fields of interest in INSN should have the
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
corresponding fields of BITMASK set to 0b1111. The function
returns return 1 if any of these fields in INSN reference the PC
(also 0b1111, r15), else it returns 0. */
static int
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
insn_references_pc (uint32_t insn, uint32_t bitmask)
{
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
uint32_t lowbit = 1;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
while (bitmask != 0)
{
uint32_t mask;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
for (; lowbit && (bitmask & lowbit) == 0; lowbit <<= 1)
;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (!lowbit)
break;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
mask = lowbit * 0xf;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if ((insn & mask) == mask)
return 1;
bitmask &= ~mask;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* The simplest copy function. Many instructions have the same effect no
matter what address they are executed at: in those cases, use this. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_copy_unmodified (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
const char *iname, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.8lx, "
"opcode/class '%s' unmodified\n", (unsigned long) insn,
iname);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->modinsn[0] = insn;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb_copy_unmodified_32bit (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, const char *iname,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.4x %.4x, "
"opcode/class '%s' unmodified\n", insn1, insn2,
iname);
dsc->modinsn[0] = insn1;
dsc->modinsn[1] = insn2;
dsc->numinsns = 2;
return 0;
}
/* Copy 16-bit Thumb(Thumb and 16-bit Thumb-2) instruction without any
modification. */
static int
thumb_copy_unmodified_16bit (struct gdbarch *gdbarch, uint16_t insn,
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
const char *iname,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.4x, "
"opcode/class '%s' unmodified\n", insn,
iname);
dsc->modinsn[0] = insn;
return 0;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Preload instructions with immediate offset. */
static void
cleanup_preload (struct gdbarch *gdbarch,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC);
if (!dsc->u.preload.immed)
displaced_write_reg (regs, dsc, 1, dsc->tmp[1], CANNOT_WRITE_PC);
}
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static void
install_preload (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc, unsigned int rn)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rn_val;
/* Preload instructions:
{pli/pld} [rn, #+/-imm]
->
{pli/pld} [r0, #+/-imm]. */
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
rn_val = displaced_read_reg (regs, dsc, rn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rn_val, CANNOT_WRITE_PC);
dsc->u.preload.immed = 1;
dsc->cleanup = &cleanup_preload;
}
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_copy_preload (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int rn = bits (insn, 16, 19);
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
if (!insn_references_pc (insn, 0x000f0000ul))
return arm_copy_unmodified (gdbarch, insn, "preload", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying preload insn %.8lx\n",
(unsigned long) insn);
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->modinsn[0] = insn & 0xfff0ffff;
install_preload (gdbarch, regs, dsc, rn);
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb2_copy_preload (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int rn = bits (insn1, 0, 3);
unsigned int u_bit = bit (insn1, 7);
int imm12 = bits (insn2, 0, 11);
ULONGEST pc_val;
if (rn != ARM_PC_REGNUM)
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "preload", dsc);
/* PC is only allowed to use in PLI (immediate,literal) Encoding T3, and
PLD (literal) Encoding T1. */
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying pld/pli pc (0x%x) %c imm12 %.4x\n",
(unsigned int) dsc->insn_addr, u_bit ? '+' : '-',
imm12);
if (!u_bit)
imm12 = -1 * imm12;
/* Rewrite instruction {pli/pld} PC imm12 into:
Prepare: tmp[0] <- r0, tmp[1] <- r1, r0 <- pc, r1 <- imm12
{pli/pld} [r0, r1]
Cleanup: r0 <- tmp[0], r1 <- tmp[1]. */
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
pc_val = displaced_read_reg (regs, dsc, ARM_PC_REGNUM);
displaced_write_reg (regs, dsc, 0, pc_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 1, imm12, CANNOT_WRITE_PC);
dsc->u.preload.immed = 0;
/* {pli/pld} [r0, r1] */
dsc->modinsn[0] = insn1 & 0xfff0;
dsc->modinsn[1] = 0xf001;
dsc->numinsns = 2;
dsc->cleanup = &cleanup_preload;
return 0;
}
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
/* Preload instructions with register offset. */
static void
install_preload_reg(struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc, unsigned int rn,
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
unsigned int rm)
{
ULONGEST rn_val, rm_val;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Preload register-offset instructions:
{pli/pld} [rn, rm {, shift}]
->
{pli/pld} [r0, r1 {, shift}]. */
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
rn_val = displaced_read_reg (regs, dsc, rn);
rm_val = displaced_read_reg (regs, dsc, rm);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rn_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 1, rm_val, CANNOT_WRITE_PC);
dsc->u.preload.immed = 0;
dsc->cleanup = &cleanup_preload;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
}
static int
arm_copy_preload_reg (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
{
unsigned int rn = bits (insn, 16, 19);
unsigned int rm = bits (insn, 0, 3);
if (!insn_references_pc (insn, 0x000f000ful))
return arm_copy_unmodified (gdbarch, insn, "preload reg", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying preload insn %.8lx\n",
(unsigned long) insn);
dsc->modinsn[0] = (insn & 0xfff0fff0) | 0x1;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
install_preload_reg (gdbarch, regs, dsc, rn, rm);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
/* Copy/cleanup coprocessor load and store instructions. */
static void
cleanup_copro_load_store (struct gdbarch *gdbarch,
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rn_val = displaced_read_reg (regs, dsc, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC);
if (dsc->u.ldst.writeback)
displaced_write_reg (regs, dsc, dsc->u.ldst.rn, rn_val, LOAD_WRITE_PC);
}
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static void
install_copro_load_store (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc,
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
int writeback, unsigned int rn)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rn_val;
/* Coprocessor load/store instructions:
{stc/stc2} [<Rn>, #+/-imm] (and other immediate addressing modes)
->
{stc/stc2} [r0, #+/-imm].
ldc/ldc2 are handled identically. */
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
rn_val = displaced_read_reg (regs, dsc, rn);
/* PC should be 4-byte aligned. */
rn_val = rn_val & 0xfffffffc;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rn_val, CANNOT_WRITE_PC);
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->u.ldst.writeback = writeback;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->u.ldst.rn = rn;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->cleanup = &cleanup_copro_load_store;
}
static int
arm_copy_copro_load_store (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
{
unsigned int rn = bits (insn, 16, 19);
if (!insn_references_pc (insn, 0x000f0000ul))
return arm_copy_unmodified (gdbarch, insn, "copro load/store", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying coprocessor "
"load/store insn %.8lx\n", (unsigned long) insn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->modinsn[0] = insn & 0xfff0ffff;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
install_copro_load_store (gdbarch, regs, dsc, bit (insn, 25), rn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb2_copy_copro_load_store (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int rn = bits (insn1, 0, 3);
if (rn != ARM_PC_REGNUM)
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"copro load/store", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying coprocessor "
"load/store insn %.4x%.4x\n", insn1, insn2);
dsc->modinsn[0] = insn1 & 0xfff0;
dsc->modinsn[1] = insn2;
dsc->numinsns = 2;
/* This function is called for copying instruction LDC/LDC2/VLDR, which
doesn't support writeback, so pass 0. */
install_copro_load_store (gdbarch, regs, dsc, 0, rn);
return 0;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Clean up branch instructions (actually perform the branch, by setting
PC). */
static void
cleanup_branch (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
int branch_taken = condition_true (dsc->u.branch.cond, status);
enum pc_write_style write_pc = dsc->u.branch.exchange
? BX_WRITE_PC : BRANCH_WRITE_PC;
if (!branch_taken)
return;
if (dsc->u.branch.link)
{
/* The value of LR should be the next insn of current one. In order
[gdb] Fix more typos in comments Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
not to confuse logic handling later insn `bx lr', if current insn mode
is Thumb, the bit 0 of LR value should be set to 1. */
ULONGEST next_insn_addr = dsc->insn_addr + dsc->insn_size;
if (dsc->is_thumb)
next_insn_addr |= 0x1;
displaced_write_reg (regs, dsc, ARM_LR_REGNUM, next_insn_addr,
CANNOT_WRITE_PC);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
displaced_write_reg (regs, dsc, ARM_PC_REGNUM, dsc->u.branch.dest, write_pc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* Copy B/BL/BLX instructions with immediate destinations. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static void
install_b_bl_blx (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc,
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
unsigned int cond, int exchange, int link, long offset)
{
/* Implement "BL<cond> <label>" as:
Preparation: cond <- instruction condition
Insn: mov r0, r0 (nop)
Cleanup: if (condition true) { r14 <- pc; pc <- label }.
B<cond> similar, but don't set r14 in cleanup. */
dsc->u.branch.cond = cond;
dsc->u.branch.link = link;
dsc->u.branch.exchange = exchange;
dsc->u.branch.dest = dsc->insn_addr;
if (link && exchange)
/* For BLX, offset is computed from the Align (PC, 4). */
dsc->u.branch.dest = dsc->u.branch.dest & 0xfffffffc;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
if (dsc->is_thumb)
dsc->u.branch.dest += 4 + offset;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
else
dsc->u.branch.dest += 8 + offset;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->cleanup = &cleanup_branch;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_copy_b_bl_blx (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int cond = bits (insn, 28, 31);
int exchange = (cond == 0xf);
int link = exchange || bit (insn, 24);
long offset;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying %s immediate insn "
"%.8lx\n", (exchange) ? "blx" : (link) ? "bl" : "b",
(unsigned long) insn);
if (exchange)
/* For BLX, set bit 0 of the destination. The cleanup_branch function will
then arrange the switch into Thumb mode. */
offset = (bits (insn, 0, 23) << 2) | (bit (insn, 24) << 1) | 1;
else
offset = bits (insn, 0, 23) << 2;
if (bit (offset, 25))
offset = offset | ~0x3ffffff;
dsc->modinsn[0] = ARM_NOP;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
install_b_bl_blx (gdbarch, regs, dsc, cond, exchange, link, offset);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb2_copy_b_bl_blx (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
int link = bit (insn2, 14);
int exchange = link && !bit (insn2, 12);
int cond = INST_AL;
long offset = 0;
int j1 = bit (insn2, 13);
int j2 = bit (insn2, 11);
int s = sbits (insn1, 10, 10);
int i1 = !(j1 ^ bit (insn1, 10));
int i2 = !(j2 ^ bit (insn1, 10));
if (!link && !exchange) /* B */
{
offset = (bits (insn2, 0, 10) << 1);
if (bit (insn2, 12)) /* Encoding T4 */
{
offset |= (bits (insn1, 0, 9) << 12)
| (i2 << 22)
| (i1 << 23)
| (s << 24);
cond = INST_AL;
}
else /* Encoding T3 */
{
offset |= (bits (insn1, 0, 5) << 12)
| (j1 << 18)
| (j2 << 19)
| (s << 20);
cond = bits (insn1, 6, 9);
}
}
else
{
offset = (bits (insn1, 0, 9) << 12);
offset |= ((i2 << 22) | (i1 << 23) | (s << 24));
offset |= exchange ?
(bits (insn2, 1, 10) << 2) : (bits (insn2, 0, 10) << 1);
}
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying %s insn "
"%.4x %.4x with offset %.8lx\n",
link ? (exchange) ? "blx" : "bl" : "b",
insn1, insn2, offset);
dsc->modinsn[0] = THUMB_NOP;
install_b_bl_blx (gdbarch, regs, dsc, cond, exchange, link, offset);
return 0;
}
/* Copy B Thumb instructions. */
static int
thumb_copy_b (struct gdbarch *gdbarch, uint16_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int cond = 0;
int offset = 0;
unsigned short bit_12_15 = bits (insn, 12, 15);
CORE_ADDR from = dsc->insn_addr;
if (bit_12_15 == 0xd)
{
/* offset = SignExtend (imm8:0, 32) */
offset = sbits ((insn << 1), 0, 8);
cond = bits (insn, 8, 11);
}
else if (bit_12_15 == 0xe) /* Encoding T2 */
{
offset = sbits ((insn << 1), 0, 11);
cond = INST_AL;
}
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying b immediate insn %.4x "
"with offset %d\n", insn, offset);
dsc->u.branch.cond = cond;
dsc->u.branch.link = 0;
dsc->u.branch.exchange = 0;
dsc->u.branch.dest = from + 4 + offset;
dsc->modinsn[0] = THUMB_NOP;
dsc->cleanup = &cleanup_branch;
return 0;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Copy BX/BLX with register-specified destinations. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static void
install_bx_blx_reg (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc, int link,
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
unsigned int cond, unsigned int rm)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
/* Implement {BX,BLX}<cond> <reg>" as:
Preparation: cond <- instruction condition
Insn: mov r0, r0 (nop)
Cleanup: if (condition true) { r14 <- pc; pc <- dest; }.
Don't set r14 in cleanup for BX. */
dsc->u.branch.dest = displaced_read_reg (regs, dsc, rm);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->u.branch.cond = cond;
dsc->u.branch.link = link;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->u.branch.exchange = 1;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->cleanup = &cleanup_branch;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static int
arm_copy_bx_blx_reg (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
{
unsigned int cond = bits (insn, 28, 31);
/* BX: x12xxx1x
BLX: x12xxx3x. */
int link = bit (insn, 5);
unsigned int rm = bits (insn, 0, 3);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.8lx",
(unsigned long) insn);
dsc->modinsn[0] = ARM_NOP;
install_bx_blx_reg (gdbarch, regs, dsc, link, cond, rm);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb_copy_bx_blx_reg (struct gdbarch *gdbarch, uint16_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
int link = bit (insn, 7);
unsigned int rm = bits (insn, 3, 6);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying insn %.4x",
(unsigned short) insn);
dsc->modinsn[0] = THUMB_NOP;
install_bx_blx_reg (gdbarch, regs, dsc, link, INST_AL, rm);
return 0;
}
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Copy/cleanup arithmetic/logic instruction with immediate RHS. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
static void
cleanup_alu_imm (struct gdbarch *gdbarch,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rd_val = displaced_read_reg (regs, dsc, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 1, dsc->tmp[1], CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, dsc->rd, rd_val, ALU_WRITE_PC);
}
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_copy_alu_imm (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int rn = bits (insn, 16, 19);
unsigned int rd = bits (insn, 12, 15);
unsigned int op = bits (insn, 21, 24);
int is_mov = (op == 0xd);
ULONGEST rd_val, rn_val;
if (!insn_references_pc (insn, 0x000ff000ul))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "ALU immediate", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying immediate %s insn "
"%.8lx\n", is_mov ? "move" : "ALU",
(unsigned long) insn);
/* Instruction is of form:
<op><cond> rd, [rn,] #imm
Rewrite as:
Preparation: tmp1, tmp2 <- r0, r1;
r0, r1 <- rd, rn
Insn: <op><cond> r0, r1, #imm
Cleanup: rd <- r0; r0 <- tmp1; r1 <- tmp2
*/
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
rn_val = displaced_read_reg (regs, dsc, rn);
rd_val = displaced_read_reg (regs, dsc, rd);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rd_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 1, rn_val, CANNOT_WRITE_PC);
dsc->rd = rd;
if (is_mov)
dsc->modinsn[0] = insn & 0xfff00fff;
else
dsc->modinsn[0] = (insn & 0xfff00fff) | 0x10000;
dsc->cleanup = &cleanup_alu_imm;
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb2_copy_alu_imm (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int op = bits (insn1, 5, 8);
unsigned int rn, rm, rd;
ULONGEST rd_val, rn_val;
rn = bits (insn1, 0, 3); /* Rn */
rm = bits (insn2, 0, 3); /* Rm */
rd = bits (insn2, 8, 11); /* Rd */
/* This routine is only called for instruction MOV. */
gdb_assert (op == 0x2 && rn == 0xf);
if (rm != ARM_PC_REGNUM && rd != ARM_PC_REGNUM)
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "ALU imm", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying reg %s insn %.4x%.4x\n",
"ALU", insn1, insn2);
/* Instruction is of form:
<op><cond> rd, [rn,] #imm
Rewrite as:
Preparation: tmp1, tmp2 <- r0, r1;
r0, r1 <- rd, rn
Insn: <op><cond> r0, r1, #imm
Cleanup: rd <- r0; r0 <- tmp1; r1 <- tmp2
*/
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
rn_val = displaced_read_reg (regs, dsc, rn);
rd_val = displaced_read_reg (regs, dsc, rd);
displaced_write_reg (regs, dsc, 0, rd_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 1, rn_val, CANNOT_WRITE_PC);
dsc->rd = rd;
dsc->modinsn[0] = insn1;
dsc->modinsn[1] = ((insn2 & 0xf0f0) | 0x1);
dsc->numinsns = 2;
dsc->cleanup = &cleanup_alu_imm;
return 0;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Copy/cleanup arithmetic/logic insns with register RHS. */
static void
cleanup_alu_reg (struct gdbarch *gdbarch,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rd_val;
int i;
rd_val = displaced_read_reg (regs, dsc, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
for (i = 0; i < 3; i++)
displaced_write_reg (regs, dsc, i, dsc->tmp[i], CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, dsc->rd, rd_val, ALU_WRITE_PC);
}
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static void
install_alu_reg (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc,
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
unsigned int rd, unsigned int rn, unsigned int rm)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rd_val, rn_val, rm_val;
/* Instruction is of form:
<op><cond> rd, [rn,] rm [, <shift>]
Rewrite as:
Preparation: tmp1, tmp2, tmp3 <- r0, r1, r2;
r0, r1, r2 <- rd, rn, rm
Insn: <op><cond> r0, [r1,] r2 [, <shift>]
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Cleanup: rd <- r0; r0, r1, r2 <- tmp1, tmp2, tmp3
*/
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
dsc->tmp[2] = displaced_read_reg (regs, dsc, 2);
rd_val = displaced_read_reg (regs, dsc, rd);
rn_val = displaced_read_reg (regs, dsc, rn);
rm_val = displaced_read_reg (regs, dsc, rm);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rd_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 1, rn_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 2, rm_val, CANNOT_WRITE_PC);
dsc->rd = rd;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->cleanup = &cleanup_alu_reg;
}
static int
arm_copy_alu_reg (struct gdbarch *gdbarch, uint32_t insn, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
{
unsigned int op = bits (insn, 21, 24);
int is_mov = (op == 0xd);
if (!insn_references_pc (insn, 0x000ff00ful))
return arm_copy_unmodified (gdbarch, insn, "ALU reg", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying reg %s insn %.8lx\n",
is_mov ? "move" : "ALU", (unsigned long) insn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (is_mov)
dsc->modinsn[0] = (insn & 0xfff00ff0) | 0x2;
else
dsc->modinsn[0] = (insn & 0xfff00ff0) | 0x10002;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
install_alu_reg (gdbarch, regs, dsc, bits (insn, 12, 15), bits (insn, 16, 19),
bits (insn, 0, 3));
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb_copy_alu_reg (struct gdbarch *gdbarch, uint16_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned rm, rd;
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
rm = bits (insn, 3, 6);
rd = (bit (insn, 7) << 3) | bits (insn, 0, 2);
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
if (rd != ARM_PC_REGNUM && rm != ARM_PC_REGNUM)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
return thumb_copy_unmodified_16bit (gdbarch, insn, "ALU reg", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying ALU reg insn %.4x\n",
(unsigned short) insn);
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
dsc->modinsn[0] = ((insn & 0xff00) | 0x10);
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
install_alu_reg (gdbarch, regs, dsc, rd, rd, rm);
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
return 0;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Cleanup/copy arithmetic/logic insns with shifted register RHS. */
static void
cleanup_alu_shifted_reg (struct gdbarch *gdbarch,
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rd_val = displaced_read_reg (regs, dsc, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
int i;
for (i = 0; i < 4; i++)
displaced_write_reg (regs, dsc, i, dsc->tmp[i], CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, dsc->rd, rd_val, ALU_WRITE_PC);
}
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static void
install_alu_shifted_reg (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc,
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
unsigned int rd, unsigned int rn, unsigned int rm,
unsigned rs)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
int i;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
ULONGEST rd_val, rn_val, rm_val, rs_val;
/* Instruction is of form:
<op><cond> rd, [rn,] rm, <shift> rs
Rewrite as:
Preparation: tmp1, tmp2, tmp3, tmp4 <- r0, r1, r2, r3
r0, r1, r2, r3 <- rd, rn, rm, rs
Insn: <op><cond> r0, r1, r2, <shift> r3
Cleanup: tmp5 <- r0
r0, r1, r2, r3 <- tmp1, tmp2, tmp3, tmp4
rd <- tmp5
*/
for (i = 0; i < 4; i++)
dsc->tmp[i] = displaced_read_reg (regs, dsc, i);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
rd_val = displaced_read_reg (regs, dsc, rd);
rn_val = displaced_read_reg (regs, dsc, rn);
rm_val = displaced_read_reg (regs, dsc, rm);
rs_val = displaced_read_reg (regs, dsc, rs);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rd_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 1, rn_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 2, rm_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 3, rs_val, CANNOT_WRITE_PC);
dsc->rd = rd;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->cleanup = &cleanup_alu_shifted_reg;
}
static int
arm_copy_alu_shifted_reg (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
{
unsigned int op = bits (insn, 21, 24);
int is_mov = (op == 0xd);
unsigned int rd, rn, rm, rs;
if (!insn_references_pc (insn, 0x000fff0ful))
return arm_copy_unmodified (gdbarch, insn, "ALU shifted reg", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying shifted reg %s insn "
"%.8lx\n", is_mov ? "move" : "ALU",
(unsigned long) insn);
rn = bits (insn, 16, 19);
rm = bits (insn, 0, 3);
rs = bits (insn, 8, 11);
rd = bits (insn, 12, 15);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (is_mov)
dsc->modinsn[0] = (insn & 0xfff000f0) | 0x302;
else
dsc->modinsn[0] = (insn & 0xfff000f0) | 0x10302;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
install_alu_shifted_reg (gdbarch, regs, dsc, rd, rn, rm, rs);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 0;
}
/* Clean up load instructions. */
static void
cleanup_load (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rt_val, rt_val2 = 0, rn_val;
rt_val = displaced_read_reg (regs, dsc, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (dsc->u.ldst.xfersize == 8)
rt_val2 = displaced_read_reg (regs, dsc, 1);
rn_val = displaced_read_reg (regs, dsc, 2);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC);
if (dsc->u.ldst.xfersize > 4)
displaced_write_reg (regs, dsc, 1, dsc->tmp[1], CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 2, dsc->tmp[2], CANNOT_WRITE_PC);
if (!dsc->u.ldst.immed)
displaced_write_reg (regs, dsc, 3, dsc->tmp[3], CANNOT_WRITE_PC);
/* Handle register writeback. */
if (dsc->u.ldst.writeback)
displaced_write_reg (regs, dsc, dsc->u.ldst.rn, rn_val, CANNOT_WRITE_PC);
/* Put result in right place. */
displaced_write_reg (regs, dsc, dsc->rd, rt_val, LOAD_WRITE_PC);
if (dsc->u.ldst.xfersize == 8)
displaced_write_reg (regs, dsc, dsc->rd + 1, rt_val2, LOAD_WRITE_PC);
}
/* Clean up store instructions. */
static void
cleanup_store (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rn_val = displaced_read_reg (regs, dsc, 2);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, dsc->tmp[0], CANNOT_WRITE_PC);
if (dsc->u.ldst.xfersize > 4)
displaced_write_reg (regs, dsc, 1, dsc->tmp[1], CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 2, dsc->tmp[2], CANNOT_WRITE_PC);
if (!dsc->u.ldst.immed)
displaced_write_reg (regs, dsc, 3, dsc->tmp[3], CANNOT_WRITE_PC);
if (!dsc->u.ldst.restore_r4)
displaced_write_reg (regs, dsc, 4, dsc->tmp[4], CANNOT_WRITE_PC);
/* Writeback. */
if (dsc->u.ldst.writeback)
displaced_write_reg (regs, dsc, dsc->u.ldst.rn, rn_val, CANNOT_WRITE_PC);
}
/* Copy "extra" load/store instructions. These are halfword/doubleword
transfers, which have a different encoding to byte/word transfers. */
static int
arm_copy_extra_ld_st (struct gdbarch *gdbarch, uint32_t insn, int unprivileged,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int op1 = bits (insn, 20, 24);
unsigned int op2 = bits (insn, 5, 6);
unsigned int rt = bits (insn, 12, 15);
unsigned int rn = bits (insn, 16, 19);
unsigned int rm = bits (insn, 0, 3);
char load[12] = {0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1};
char bytesize[12] = {2, 2, 2, 2, 8, 1, 8, 1, 8, 2, 8, 2};
int immed = (op1 & 0x4) != 0;
int opcode;
ULONGEST rt_val, rt_val2 = 0, rn_val, rm_val = 0;
if (!insn_references_pc (insn, 0x000ff00ful))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "extra load/store", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying %sextra load/store "
"insn %.8lx\n", unprivileged ? "unprivileged " : "",
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
(unsigned long) insn);
opcode = ((op2 << 2) | (op1 & 0x1) | ((op1 & 0x4) >> 1)) - 4;
if (opcode < 0)
internal_error (__FILE__, __LINE__,
_("copy_extra_ld_st: instruction decode error"));
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[1] = displaced_read_reg (regs, dsc, 1);
dsc->tmp[2] = displaced_read_reg (regs, dsc, 2);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (!immed)
dsc->tmp[3] = displaced_read_reg (regs, dsc, 3);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
rt_val = displaced_read_reg (regs, dsc, rt);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (bytesize[opcode] == 8)
rt_val2 = displaced_read_reg (regs, dsc, rt + 1);
rn_val = displaced_read_reg (regs, dsc, rn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (!immed)
rm_val = displaced_read_reg (regs, dsc, rm);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rt_val, CANNOT_WRITE_PC);
if (bytesize[opcode] == 8)
displaced_write_reg (regs, dsc, 1, rt_val2, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 2, rn_val, CANNOT_WRITE_PC);
if (!immed)
displaced_write_reg (regs, dsc, 3, rm_val, CANNOT_WRITE_PC);
dsc->rd = rt;
dsc->u.ldst.xfersize = bytesize[opcode];
dsc->u.ldst.rn = rn;
dsc->u.ldst.immed = immed;
dsc->u.ldst.writeback = bit (insn, 24) == 0 || bit (insn, 21) != 0;
dsc->u.ldst.restore_r4 = 0;
if (immed)
/* {ldr,str}<width><cond> rt, [rt2,] [rn, #imm]
->
{ldr,str}<width><cond> r0, [r1,] [r2, #imm]. */
dsc->modinsn[0] = (insn & 0xfff00fff) | 0x20000;
else
/* {ldr,str}<width><cond> rt, [rt2,] [rn, +/-rm]
->
{ldr,str}<width><cond> r0, [r1,] [r2, +/-r3]. */
dsc->modinsn[0] = (insn & 0xfff00ff0) | 0x20003;
dsc->cleanup = load[opcode] ? &cleanup_load : &cleanup_store;
return 0;
}
/* Copy byte/half word/word loads and stores. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static void
install_load_store (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc, int load,
int immed, int writeback, int size, int usermode,
int rt, int rm, int rn)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
ULONGEST rt_val, rn_val, rm_val = 0;
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[2] = displaced_read_reg (regs, dsc, 2);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (!immed)
dsc->tmp[3] = displaced_read_reg (regs, dsc, 3);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (!load)
dsc->tmp[4] = displaced_read_reg (regs, dsc, 4);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
rt_val = displaced_read_reg (regs, dsc, rt);
rn_val = displaced_read_reg (regs, dsc, rn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (!immed)
rm_val = displaced_read_reg (regs, dsc, rm);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, 0, rt_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 2, rn_val, CANNOT_WRITE_PC);
if (!immed)
displaced_write_reg (regs, dsc, 3, rm_val, CANNOT_WRITE_PC);
dsc->rd = rt;
dsc->u.ldst.xfersize = size;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->u.ldst.rn = rn;
dsc->u.ldst.immed = immed;
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->u.ldst.writeback = writeback;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* To write PC we can do:
Before this sequence of instructions:
r0 is the PC value got from displaced_read_reg, so r0 = from + 8;
[gdb] Fix more typos in comments Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
r2 is the Rn value got from displaced_read_reg.
Insn1: push {pc} Write address of STR instruction + offset on stack
Insn2: pop {r4} Read it back from stack, r4 = addr(Insn1) + offset
Insn3: sub r4, r4, pc r4 = addr(Insn1) + offset - pc
= addr(Insn1) + offset - addr(Insn3) - 8
= offset - 16
Insn4: add r4, r4, #8 r4 = offset - 8
Insn5: add r0, r0, r4 r0 = from + 8 + offset - 8
= from + offset
Insn6: str r0, [r2, #imm] (or str r0, [r2, r3])
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Otherwise we don't know what value to write for PC, since the offset is
architecture-dependent (sometimes PC+8, sometimes PC+12). More details
of this can be found in Section "Saving from r15" in
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204g/Cihbjifh.html */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
dsc->cleanup = load ? &cleanup_load : &cleanup_store;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb2_copy_load_literal (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc, int size)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int u_bit = bit (insn1, 7);
unsigned int rt = bits (insn2, 12, 15);
int imm12 = bits (insn2, 0, 11);
ULONGEST pc_val;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying ldr pc (0x%x) R%d %c imm12 %.4x\n",
(unsigned int) dsc->insn_addr, rt, u_bit ? '+' : '-',
imm12);
if (!u_bit)
imm12 = -1 * imm12;
/* Rewrite instruction LDR Rt imm12 into:
Prepare: tmp[0] <- r0, tmp[1] <- r2, tmp[2] <- r3, r2 <- pc, r3 <- imm12
LDR R0, R2, R3,
Cleanup: rt <- r0, r0 <- tmp[0], r2 <- tmp[1], r3 <- tmp[2]. */
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[2] = displaced_read_reg (regs, dsc, 2);
dsc->tmp[3] = displaced_read_reg (regs, dsc, 3);
pc_val = displaced_read_reg (regs, dsc, ARM_PC_REGNUM);
pc_val = pc_val & 0xfffffffc;
displaced_write_reg (regs, dsc, 2, pc_val, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 3, imm12, CANNOT_WRITE_PC);
dsc->rd = rt;
dsc->u.ldst.xfersize = size;
dsc->u.ldst.immed = 0;
dsc->u.ldst.writeback = 0;
dsc->u.ldst.restore_r4 = 0;
/* LDR R0, R2, R3 */
dsc->modinsn[0] = 0xf852;
dsc->modinsn[1] = 0x3;
dsc->numinsns = 2;
dsc->cleanup = &cleanup_load;
return 0;
}
static int
thumb2_copy_load_reg_imm (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc,
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
int writeback, int immed)
{
unsigned int rt = bits (insn2, 12, 15);
unsigned int rn = bits (insn1, 0, 3);
unsigned int rm = bits (insn2, 0, 3); /* Only valid if !immed. */
/* In LDR (register), there is also a register Rm, which is not allowed to
be PC, so we don't have to check it. */
if (rt != ARM_PC_REGNUM && rn != ARM_PC_REGNUM)
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "load",
dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying ldr r%d [r%d] insn %.4x%.4x\n",
rt, rn, insn1, insn2);
install_load_store (gdbarch, regs, dsc, 1, immed, writeback, 4,
0, rt, rm, rn);
dsc->u.ldst.restore_r4 = 0;
if (immed)
/* ldr[b]<cond> rt, [rn, #imm], etc.
->
ldr[b]<cond> r0, [r2, #imm]. */
{
dsc->modinsn[0] = (insn1 & 0xfff0) | 0x2;
dsc->modinsn[1] = insn2 & 0x0fff;
}
else
/* ldr[b]<cond> rt, [rn, rm], etc.
->
ldr[b]<cond> r0, [r2, r3]. */
{
dsc->modinsn[0] = (insn1 & 0xfff0) | 0x2;
dsc->modinsn[1] = (insn2 & 0x0ff0) | 0x3;
}
dsc->numinsns = 2;
return 0;
}
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
static int
arm_copy_ldr_str_ldrb_strb (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc,
int load, int size, int usermode)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
{
int immed = !bit (insn, 25);
int writeback = (bit (insn, 24) == 0 || bit (insn, 21) != 0);
unsigned int rt = bits (insn, 12, 15);
unsigned int rn = bits (insn, 16, 19);
unsigned int rm = bits (insn, 0, 3); /* Only valid if !immed. */
if (!insn_references_pc (insn, 0x000ff00ful))
return arm_copy_unmodified (gdbarch, insn, "load/store", dsc);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying %s%s r%d [r%d] insn %.8lx\n",
load ? (size == 1 ? "ldrb" : "ldr")
: (size == 1 ? "strb" : "str"), usermode ? "t" : "",
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
rt, rn,
(unsigned long) insn);
install_load_store (gdbarch, regs, dsc, load, immed, writeback, size,
usermode, rt, rm, rn);
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
if (load || rt != ARM_PC_REGNUM)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
dsc->u.ldst.restore_r4 = 0;
if (immed)
/* {ldr,str}[b]<cond> rt, [rn, #imm], etc.
->
{ldr,str}[b]<cond> r0, [r2, #imm]. */
dsc->modinsn[0] = (insn & 0xfff00fff) | 0x20000;
else
/* {ldr,str}[b]<cond> rt, [rn, rm], etc.
->
{ldr,str}[b]<cond> r0, [r2, r3]. */
dsc->modinsn[0] = (insn & 0xfff00ff0) | 0x20003;
}
else
{
/* We need to use r4 as scratch. Make sure it's restored afterwards. */
dsc->u.ldst.restore_r4 = 1;
dsc->modinsn[0] = 0xe92d8000; /* push {pc} */
dsc->modinsn[1] = 0xe8bd0010; /* pop {r4} */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->modinsn[2] = 0xe044400f; /* sub r4, r4, pc. */
dsc->modinsn[3] = 0xe2844008; /* add r4, r4, #8. */
dsc->modinsn[4] = 0xe0800004; /* add r0, r0, r4. */
/* As above. */
if (immed)
dsc->modinsn[5] = (insn & 0xfff00fff) | 0x20000;
else
dsc->modinsn[5] = (insn & 0xfff00ff0) | 0x20003;
dsc->numinsns = 6;
}
dsc->cleanup = load ? &cleanup_load : &cleanup_store;
return 0;
}
/* Cleanup LDM instructions with fully-populated register list. This is an
unfortunate corner case: it's impossible to implement correctly by modifying
the instruction. The issue is as follows: we have an instruction,
ldm rN, {r0-r15}
which we must rewrite to avoid loading PC. A possible solution would be to
do the load in two halves, something like (with suitable cleanup
afterwards):
mov r8, rN
ldm[id][ab] r8!, {r0-r7}
str r7, <temp>
ldm[id][ab] r8, {r7-r14}
<bkpt>
but at present there's no suitable place for <temp>, since the scratch space
is overwritten before the cleanup routine is called. For now, we simply
emulate the instruction. */
static void
cleanup_block_load_all (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
int inc = dsc->u.block.increment;
int bump_before = dsc->u.block.before ? (inc ? 4 : -4) : 0;
int bump_after = dsc->u.block.before ? 0 : (inc ? 4 : -4);
uint32_t regmask = dsc->u.block.regmask;
int regno = inc ? 0 : 15;
CORE_ADDR xfer_addr = dsc->u.block.xfer_addr;
int exception_return = dsc->u.block.load && dsc->u.block.user
&& (regmask & 0x8000) != 0;
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
int do_transfer = condition_true (dsc->u.block.cond, status);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (!do_transfer)
return;
/* If the instruction is ldm rN, {...pc}^, I don't think there's anything
sensible we can do here. Complain loudly. */
if (exception_return)
error (_("Cannot single-step exception return"));
/* We don't handle any stores here for now. */
gdb_assert (dsc->u.block.load != 0);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: emulating block transfer: "
"%s %s %s\n", dsc->u.block.load ? "ldm" : "stm",
dsc->u.block.increment ? "inc" : "dec",
dsc->u.block.before ? "before" : "after");
while (regmask)
{
uint32_t memword;
if (inc)
while (regno <= ARM_PC_REGNUM && (regmask & (1 << regno)) == 0)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
regno++;
else
while (regno >= 0 && (regmask & (1 << regno)) == 0)
regno--;
xfer_addr += bump_before;
memword = read_memory_unsigned_integer (xfer_addr, 4, byte_order);
displaced_write_reg (regs, dsc, regno, memword, LOAD_WRITE_PC);
xfer_addr += bump_after;
regmask &= ~(1 << regno);
}
if (dsc->u.block.writeback)
displaced_write_reg (regs, dsc, dsc->u.block.rn, xfer_addr,
CANNOT_WRITE_PC);
}
/* Clean up an STM which included the PC in the register list. */
static void
cleanup_block_store_pc (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
int store_executed = condition_true (dsc->u.block.cond, status);
gnulib: import count-one-bits module and use it For a fix I intend to submit, I would need a function that counts the number of set bits in a word. There is __builtin_popcount that is supported by gcc and clang, but there is also a gnulib module that wraps that and provides a fallback for other compilers, so I think it would be good to use it. I also noticed that there is a bitcount function in arch/arm.c, so I thought that as a first step I would replace that one with the gnulib count-one-bits module. This is what this patch does. The gnulib module provides multiple functions, with various parameter length (unsigned int, unsigned long int, unsigned long long int), I chose the one that made sense for each call site based on the argument type. gnulib/ChangeLog: * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import count-one-bits module. * configure: Re-generate. * aclocal.m4: Re-generate. * Makefile.in: Re-generate. * import/count-one-bits.c: New file. * import/count-one-bits.h: New file. * import/Makefile.am: Re-generate. * import/Makefile.in: Re-generate. * import/m4/gnulib-cache.m4: Re-generate. * import/m4/gnulib-comp.m4: Re-generate. * import/m4/count-one-bits.m4: New file. gdb/ChangeLog: * arm-tdep.c: Include count-one-bits.h. (cleanup_block_store_pc): Use count_one_bits. (cleanup_block_load_pc): Use count_one_bits. (arm_copy_block_xfer): Use count_one_bits. (thumb2_copy_block_xfer): Use count_one_bits. (thumb_copy_pop_pc_16bit): Use count_one_bits. * arch/arm-get-next-pcs.c: Include count-one-bits.h. (thumb_get_next_pcs_raw): Use count_one_bits. (arm_get_next_pcs_raw): Use count_one_bits_l. * arch/arm.c (bitcount): Remove. * arch/arm.h (bitcount): Remove.
2020-02-14 20:41:07 +01:00
CORE_ADDR pc_stored_at, transferred_regs
= count_one_bits (dsc->u.block.regmask);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
CORE_ADDR stm_insn_addr;
uint32_t pc_val;
long offset;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* If condition code fails, there's nothing else to do. */
if (!store_executed)
return;
if (dsc->u.block.increment)
{
pc_stored_at = dsc->u.block.xfer_addr + 4 * transferred_regs;
if (dsc->u.block.before)
pc_stored_at += 4;
}
else
{
pc_stored_at = dsc->u.block.xfer_addr;
if (dsc->u.block.before)
pc_stored_at -= 4;
}
pc_val = read_memory_unsigned_integer (pc_stored_at, 4, byte_order);
stm_insn_addr = dsc->scratch_base;
offset = pc_val - stm_insn_addr;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: detected PC offset %.8lx for "
"STM instruction\n", offset);
/* Rewrite the stored PC to the proper value for the non-displaced original
instruction. */
write_memory_unsigned_integer (pc_stored_at, 4, byte_order,
dsc->insn_addr + offset);
}
/* Clean up an LDM which includes the PC in the register list. We clumped all
the registers in the transferred list into a contiguous range r0...rX (to
avoid loading PC directly and losing control of the debugged program), so we
must undo that here. */
static void
cleanup_block_load_pc (struct gdbarch *gdbarch,
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
uint32_t status = displaced_read_reg (regs, dsc, ARM_PS_REGNUM);
2012-05-18 Sergio Durigan Junior <sergiodj@redhat.com> * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: * avr-tdep.c: * ax-gdb.c: * bfin-linux-tdep.c: * breakpoint.c: * c-valprint.c: * cli/cli-cmds.c: * coffread.c: * cp-support.c: * cris-tdep.c: * dwarf2-frame-tailcall.c: * dwarf2-frame.c: * dwarf2expr.c: * dwarf2loc.c: * dwarf2read.c: * elfread.c: * eval.c: * expprint.c: * f-valprint.c: * frv-tdep.c: * h8300-tdep.c: * hppa-hpux-tdep.c: * hppa-tdep.c: * hppanbsd-tdep.c: * i386-nto-tdep.c: * i386-tdep.c: * i387-tdep.c: * ia64-tdep.c: * jit.c: * linespec.c: * linux-tdep.c: * lm32-tdep.c: * m2-valprint.c: * m32c-tdep.c: * m32r-rom.c: * m32r-tdep.c: * m68k-tdep.c: * m68klinux-tdep.c: * mi/mi-main.c: * microblaze-tdep.c: * mips-linux-tdep.c: * mips-tdep.c: * mn10300-tdep.c: * p-valprint.c: * parse.c: * ppc-linux-tdep.c: * ppc-sysv-tdep.c: * printcmd.c: * python/py-finishbreakpoint.c: * python/py-inferior.c: * python/py-infthread.c: * python/py-type.c: * python/python.c: * remote-fileio.c: * remote-m32r-sdi.c: * remote-mips.c: * reverse.c: * rl78-tdep.c: * rs6000-aix-tdep.c: * rs6000-tdep.c: * s390-tdep.c: * score-tdep.c: * sh64-tdep.c: * skip.c: * solib-darwin.c: * solib-dsbt.c: * solib-frv.c: * sparc-tdep.c: * spu-multiarch.c: * spu-tdep.c: * stack.c: * symfile.c: * symtab.c: * tic6x-tdep.c: * tracepoint.c: * v850-tdep.c: * valarith.c: * valprint.c: * value.c: * xcoffread.c: * xtensa-tdep.c: * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: Delete unused variables.
2012-05-18 23:02:52 +02:00
int load_executed = condition_true (dsc->u.block.cond, status);
unsigned int mask = dsc->u.block.regmask, write_reg = ARM_PC_REGNUM;
gnulib: import count-one-bits module and use it For a fix I intend to submit, I would need a function that counts the number of set bits in a word. There is __builtin_popcount that is supported by gcc and clang, but there is also a gnulib module that wraps that and provides a fallback for other compilers, so I think it would be good to use it. I also noticed that there is a bitcount function in arch/arm.c, so I thought that as a first step I would replace that one with the gnulib count-one-bits module. This is what this patch does. The gnulib module provides multiple functions, with various parameter length (unsigned int, unsigned long int, unsigned long long int), I chose the one that made sense for each call site based on the argument type. gnulib/ChangeLog: * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import count-one-bits module. * configure: Re-generate. * aclocal.m4: Re-generate. * Makefile.in: Re-generate. * import/count-one-bits.c: New file. * import/count-one-bits.h: New file. * import/Makefile.am: Re-generate. * import/Makefile.in: Re-generate. * import/m4/gnulib-cache.m4: Re-generate. * import/m4/gnulib-comp.m4: Re-generate. * import/m4/count-one-bits.m4: New file. gdb/ChangeLog: * arm-tdep.c: Include count-one-bits.h. (cleanup_block_store_pc): Use count_one_bits. (cleanup_block_load_pc): Use count_one_bits. (arm_copy_block_xfer): Use count_one_bits. (thumb2_copy_block_xfer): Use count_one_bits. (thumb_copy_pop_pc_16bit): Use count_one_bits. * arch/arm-get-next-pcs.c: Include count-one-bits.h. (thumb_get_next_pcs_raw): Use count_one_bits. (arm_get_next_pcs_raw): Use count_one_bits_l. * arch/arm.c (bitcount): Remove. * arch/arm.h (bitcount): Remove.
2020-02-14 20:41:07 +01:00
unsigned int regs_loaded = count_one_bits (mask);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
unsigned int num_to_shuffle = regs_loaded, clobbered;
/* The method employed here will fail if the register list is fully populated
(we need to avoid loading PC directly). */
gdb_assert (num_to_shuffle < 16);
if (!load_executed)
return;
clobbered = (1 << num_to_shuffle) - 1;
while (num_to_shuffle > 0)
{
if ((mask & (1 << write_reg)) != 0)
{
unsigned int read_reg = num_to_shuffle - 1;
if (read_reg != write_reg)
{
ULONGEST rval = displaced_read_reg (regs, dsc, read_reg);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
displaced_write_reg (regs, dsc, write_reg, rval, LOAD_WRITE_PC);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, _("displaced: LDM: move "
"loaded register r%d to r%d\n"), read_reg,
write_reg);
}
else if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, _("displaced: LDM: register "
"r%d already in the right place\n"),
write_reg);
clobbered &= ~(1 << write_reg);
num_to_shuffle--;
}
write_reg--;
}
/* Restore any registers we scribbled over. */
for (write_reg = 0; clobbered != 0; write_reg++)
{
if ((clobbered & (1 << write_reg)) != 0)
{
displaced_write_reg (regs, dsc, write_reg, dsc->tmp[write_reg],
CANNOT_WRITE_PC);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, _("displaced: LDM: restored "
"clobbered register r%d\n"), write_reg);
clobbered &= ~(1 << write_reg);
}
}
/* Perform register writeback manually. */
if (dsc->u.block.writeback)
{
ULONGEST new_rn_val = dsc->u.block.xfer_addr;
if (dsc->u.block.increment)
new_rn_val += regs_loaded * 4;
else
new_rn_val -= regs_loaded * 4;
displaced_write_reg (regs, dsc, dsc->u.block.rn, new_rn_val,
CANNOT_WRITE_PC);
}
}
/* Handle ldm/stm, apart from some tricky cases which are unlikely to occur
in user-level code (in particular exception return, ldm rn, {...pc}^). */
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_copy_block_xfer (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
int load = bit (insn, 20);
int user = bit (insn, 22);
int increment = bit (insn, 23);
int before = bit (insn, 24);
int writeback = bit (insn, 21);
int rn = bits (insn, 16, 19);
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
/* Block transfers which don't mention PC can be run directly
out-of-line. */
if (rn != ARM_PC_REGNUM && (insn & 0x8000) == 0)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "ldm/stm", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (rn == ARM_PC_REGNUM)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
warning (_("displaced: Unpredictable LDM or STM with "
"base register r15"));
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "unpredictable ldm/stm", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying block transfer insn "
"%.8lx\n", (unsigned long) insn);
dsc->u.block.xfer_addr = displaced_read_reg (regs, dsc, rn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->u.block.rn = rn;
dsc->u.block.load = load;
dsc->u.block.user = user;
dsc->u.block.increment = increment;
dsc->u.block.before = before;
dsc->u.block.writeback = writeback;
dsc->u.block.cond = bits (insn, 28, 31);
dsc->u.block.regmask = insn & 0xffff;
if (load)
{
if ((insn & 0xffff) == 0xffff)
{
/* LDM with a fully-populated register list. This case is
particularly tricky. Implement for now by fully emulating the
instruction (which might not behave perfectly in all cases, but
these instructions should be rare enough for that not to matter
too much). */
dsc->modinsn[0] = ARM_NOP;
dsc->cleanup = &cleanup_block_load_all;
}
else
{
/* LDM of a list of registers which includes PC. Implement by
rewriting the list of registers to be transferred into a
contiguous chunk r0...rX before doing the transfer, then shuffling
registers into the correct places in the cleanup routine. */
unsigned int regmask = insn & 0xffff;
gnulib: import count-one-bits module and use it For a fix I intend to submit, I would need a function that counts the number of set bits in a word. There is __builtin_popcount that is supported by gcc and clang, but there is also a gnulib module that wraps that and provides a fallback for other compilers, so I think it would be good to use it. I also noticed that there is a bitcount function in arch/arm.c, so I thought that as a first step I would replace that one with the gnulib count-one-bits module. This is what this patch does. The gnulib module provides multiple functions, with various parameter length (unsigned int, unsigned long int, unsigned long long int), I chose the one that made sense for each call site based on the argument type. gnulib/ChangeLog: * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import count-one-bits module. * configure: Re-generate. * aclocal.m4: Re-generate. * Makefile.in: Re-generate. * import/count-one-bits.c: New file. * import/count-one-bits.h: New file. * import/Makefile.am: Re-generate. * import/Makefile.in: Re-generate. * import/m4/gnulib-cache.m4: Re-generate. * import/m4/gnulib-comp.m4: Re-generate. * import/m4/count-one-bits.m4: New file. gdb/ChangeLog: * arm-tdep.c: Include count-one-bits.h. (cleanup_block_store_pc): Use count_one_bits. (cleanup_block_load_pc): Use count_one_bits. (arm_copy_block_xfer): Use count_one_bits. (thumb2_copy_block_xfer): Use count_one_bits. (thumb_copy_pop_pc_16bit): Use count_one_bits. * arch/arm-get-next-pcs.c: Include count-one-bits.h. (thumb_get_next_pcs_raw): Use count_one_bits. (arm_get_next_pcs_raw): Use count_one_bits_l. * arch/arm.c (bitcount): Remove. * arch/arm.h (bitcount): Remove.
2020-02-14 20:41:07 +01:00
unsigned int num_in_list = count_one_bits (regmask), new_regmask;
unsigned int i;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
for (i = 0; i < num_in_list; i++)
dsc->tmp[i] = displaced_read_reg (regs, dsc, i);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Writeback makes things complicated. We need to avoid clobbering
the base register with one of the registers in our modified
register list, but just using a different register can't work in
all cases, e.g.:
ldm r14!, {r0-r13,pc}
which would need to be rewritten as:
ldm rN!, {r0-r14}
but that can't work, because there's no free register for N.
Solve this by turning off the writeback bit, and emulating
writeback manually in the cleanup routine. */
if (writeback)
insn &= ~(1 << 21);
new_regmask = (1 << num_in_list) - 1;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, _("displaced: LDM r%d%s, "
"{..., pc}: original reg list %.4x, modified "
"list %.4x\n"), rn, writeback ? "!" : "",
(int) insn & 0xffff, new_regmask);
dsc->modinsn[0] = (insn & ~0xffff) | (new_regmask & 0xffff);
dsc->cleanup = &cleanup_block_load_pc;
}
}
else
{
/* STM of a list of registers which includes PC. Run the instruction
as-is, but out of line: this will store the wrong value for the PC,
so we must manually fix up the memory in the cleanup routine.
Doing things this way has the advantage that we can auto-detect
the offset of the PC write (which is architecture-dependent) in
the cleanup routine. */
dsc->modinsn[0] = insn;
dsc->cleanup = &cleanup_block_store_pc;
}
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb2_copy_block_xfer (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
int rn = bits (insn1, 0, 3);
int load = bit (insn1, 4);
int writeback = bit (insn1, 5);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
/* Block transfers which don't mention PC can be run directly
out-of-line. */
if (rn != ARM_PC_REGNUM && (insn2 & 0x8000) == 0)
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "ldm/stm", dsc);
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
if (rn == ARM_PC_REGNUM)
{
warning (_("displaced: Unpredictable LDM or STM with "
"base register r15"));
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"unpredictable ldm/stm", dsc);
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
fprintf_unfiltered (gdb_stdlog, "displaced: copying block transfer insn "
"%.4x%.4x\n", insn1, insn2);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
/* Clear bit 13, since it should be always zero. */
dsc->u.block.regmask = (insn2 & 0xdfff);
dsc->u.block.rn = rn;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
dsc->u.block.load = load;
dsc->u.block.user = 0;
dsc->u.block.increment = bit (insn1, 7);
dsc->u.block.before = bit (insn1, 8);
dsc->u.block.writeback = writeback;
dsc->u.block.cond = INST_AL;
dsc->u.block.xfer_addr = displaced_read_reg (regs, dsc, rn);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
if (load)
{
if (dsc->u.block.regmask == 0xffff)
{
/* This branch is impossible to happen. */
gdb_assert (0);
}
else
{
unsigned int regmask = dsc->u.block.regmask;
gnulib: import count-one-bits module and use it For a fix I intend to submit, I would need a function that counts the number of set bits in a word. There is __builtin_popcount that is supported by gcc and clang, but there is also a gnulib module that wraps that and provides a fallback for other compilers, so I think it would be good to use it. I also noticed that there is a bitcount function in arch/arm.c, so I thought that as a first step I would replace that one with the gnulib count-one-bits module. This is what this patch does. The gnulib module provides multiple functions, with various parameter length (unsigned int, unsigned long int, unsigned long long int), I chose the one that made sense for each call site based on the argument type. gnulib/ChangeLog: * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import count-one-bits module. * configure: Re-generate. * aclocal.m4: Re-generate. * Makefile.in: Re-generate. * import/count-one-bits.c: New file. * import/count-one-bits.h: New file. * import/Makefile.am: Re-generate. * import/Makefile.in: Re-generate. * import/m4/gnulib-cache.m4: Re-generate. * import/m4/gnulib-comp.m4: Re-generate. * import/m4/count-one-bits.m4: New file. gdb/ChangeLog: * arm-tdep.c: Include count-one-bits.h. (cleanup_block_store_pc): Use count_one_bits. (cleanup_block_load_pc): Use count_one_bits. (arm_copy_block_xfer): Use count_one_bits. (thumb2_copy_block_xfer): Use count_one_bits. (thumb_copy_pop_pc_16bit): Use count_one_bits. * arch/arm-get-next-pcs.c: Include count-one-bits.h. (thumb_get_next_pcs_raw): Use count_one_bits. (arm_get_next_pcs_raw): Use count_one_bits_l. * arch/arm.c (bitcount): Remove. * arch/arm.h (bitcount): Remove.
2020-02-14 20:41:07 +01:00
unsigned int num_in_list = count_one_bits (regmask), new_regmask;
unsigned int i;
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
for (i = 0; i < num_in_list; i++)
dsc->tmp[i] = displaced_read_reg (regs, dsc, i);
if (writeback)
insn1 &= ~(1 << 5);
new_regmask = (1 << num_in_list) - 1;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, _("displaced: LDM r%d%s, "
"{..., pc}: original reg list %.4x, modified "
"list %.4x\n"), rn, writeback ? "!" : "",
(int) dsc->u.block.regmask, new_regmask);
dsc->modinsn[0] = insn1;
dsc->modinsn[1] = (new_regmask & 0xffff);
dsc->numinsns = 2;
dsc->cleanup = &cleanup_block_load_pc;
}
}
else
{
dsc->modinsn[0] = insn1;
dsc->modinsn[1] = insn2;
dsc->numinsns = 2;
dsc->cleanup = &cleanup_block_store_pc;
}
return 0;
}
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
/* Wrapper over read_memory_unsigned_integer for use in arm_get_next_pcs.
This is used to avoid a dependency on BFD's bfd_endian enum. */
ULONGEST
arm_get_next_pcs_read_memory_unsigned_integer (CORE_ADDR memaddr, int len,
int byte_order)
{
return read_memory_unsigned_integer (memaddr, len,
(enum bfd_endian) byte_order);
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
}
/* Wrapper over gdbarch_addr_bits_remove for use in arm_get_next_pcs. */
CORE_ADDR
arm_get_next_pcs_addr_bits_remove (struct arm_get_next_pcs *self,
CORE_ADDR val)
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
return gdbarch_addr_bits_remove (self->regcache->arch (), val);
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
}
/* Wrapper over syscall_next_pc for use in get_next_pcs. */
static CORE_ADDR
arm_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
{
return 0;
}
/* Wrapper over arm_is_thumb for use in arm_get_next_pcs. */
int
arm_get_next_pcs_is_thumb (struct arm_get_next_pcs *self)
{
return arm_is_thumb (self->regcache);
}
/* single_step() is called just before we want to resume the inferior,
if we want to single-step it but there is no hardware or kernel
single-step support. We find the target of the coming instructions
and breakpoint them. */
Change return type of gdbarch_software_single_step to vector<CORE_ADDR> This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-05-02 19:30:07 +02:00
std::vector<CORE_ADDR>
Change gdbarch software_single_step frame_info to regcache This patch changes gdbarch method software_single_step's parameter from "struct frame_info *" to "struct regcache *, IOW, software_single_step starts to use current regcache rather than current frame for software single. gdb: 2016-11-22 Yao Qi <yao.qi@linaro.org> * gdbarch.sh (software_single_step): Change parameter from frame_info to regcache. * gdbarch.c, gdbarch.h: Regenerated. * aarch64-tdep.c (aarch64_software_single_step): Change parameter from frame_info to regcache. Don't call get_current_regcache. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise. (alpha_software_single_step): Likewise. * alpha-tdep.h (alpha_software_single_step): Update declaration. * arm-linux-tdep.c (arm_linux_software_single_step): Likewise. * arm-tdep.c (arm_software_single_step): Likewise. * arm-tdep.h (arm_software_single_step): Likewise. * breakpoint.c (insert_single_step_breakpoint): Pass regcache to gdbarch_software_single_step. * cris-tdep.c (cris_software_single_step): Change parameter from frame_info to regcache. Don't call get_current_regcache. * mips-tdep.c (mips_software_single_step): Likewise. * mips-tdep.h (mips_software_single_step): Update declaration. * moxie-tdep.c (moxie_software_single_step): Likewise. * nios2-tdep.c (nios2_software_single_step): Likewise. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Update declaration. * rs6000-aix-tdep.c (rs6000_software_single_step): Likewise. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise. * s390-linux-tdep.c (s390_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * spu-tdep.c (spu_software_single_step): Likewise. * tic6x-tdep.c (tic6x_software_single_step): Likewise.
2016-11-22 15:05:06 +01:00
arm_software_single_step (struct regcache *regcache)
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
struct gdbarch *gdbarch = regcache->arch ();
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
struct arm_get_next_pcs next_pcs_ctx;
arm_get_next_pcs_ctor (&next_pcs_ctx,
&arm_get_next_pcs_ops,
gdbarch_byte_order (gdbarch),
gdbarch_byte_order_for_code (gdbarch),
[ARM] Make thumb2_breakpoint static again This patch makes thumb2_breakpoint static. When writing this patch, I find the only reason we keep thumb2_breakpoint extern is that it is used as an argument passed to arm_gdbserver_get_next_pcs. However, field arm_thumb2_breakpoint is only used in a null check in thumb_get_next_pcs_raw, so I wonder why do need to pass thumb2_breakpoint to arm_gdbserver_get_next_pcs. thumb2_breakpoint was added by Daniel Jacobowitz in order to support single-step IT block https://sourceware.org/ml/gdb-patches/2010-01/msg00624.html the logic there was if we have 32-bit thumb-2 breakpoint defined, we can safely single-step IT block, otherwise, we can't. Daniel didn't want to use 16-bit thumb BKPT instruction, because it triggers even on instruction which should be executed. Secondly, using 16-bit thumb illegal instruction on top of 32-bit thumb instruction may break the meaning of original IT blocks, because the other 16-bit can be regarded as an instruction. See more explanations from Daniel's kernel patch http://www.spinics.net/lists/arm-kernel/msg80476.html Let us back to this patch, GDB/GDBserver can safely single step IT block if thumb2_breakpoint is defined, but the single step logic doesn't have to know the thumb-2 breakpoint instruction. Only breakpoint insertion mechanism decides to use which breakpoint instruction. In the software single step code, instead of pass thumb2_breakpoint, we can pass a boolean variable has_thumb2_breakpoint indicate whether the target has thumb-2 breakpoint defined, which is equivalent to the original code. Regression tested on arm-linux. No regression. gdb: 2016-01-14 Yao Qi <yao.qi@linaro.org> * arch/arm-get-next-pcs.c (arm_get_next_pcs_ctor): Change argument arm_thumb2_breakpoint to has_thumb2_breakpoint. (thumb_get_next_pcs_raw): Check has_thumb2_breakpoint instead. * arch/arm-get-next-pcs.h (struct arm_get_next_pcs) <arm_thumb2_breakpoint>: Remove. <has_thumb2_breakpoint>: New field. (arm_get_next_pcs_ctor): Update declaration. * arm-linux-tdep.c (arm_linux_software_single_step): Pass 1 to arm_get_next_pcs_ctor. * arm-tdep.c (arm_software_single_step): Pass 0 to arm_get_next_pcs_ctor. gdb/gdbserver: 2016-01-14 Yao Qi <yao.qi@linaro.org> * linux-aarch32-low.c (thumb2_breakpoint): Make it static. * linux-aarch32-low.h (thumb2_breakpoint): Remove declaration. * linux-arm-low.c (arm_gdbserver_get_next_pcs): Pass 1 to arm_get_next_pcs_ctor.
2016-01-14 10:36:43 +01:00
0,
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
regcache);
Change return type of gdbarch_software_single_step to vector<CORE_ADDR> This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-05-02 19:30:07 +02:00
std::vector<CORE_ADDR> next_pcs = arm_get_next_pcs (&next_pcs_ctx);
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
Change return type of gdbarch_software_single_step to vector<CORE_ADDR> This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-05-02 19:30:07 +02:00
for (CORE_ADDR &pc_ref : next_pcs)
pc_ref = gdbarch_addr_bits_remove (gdbarch, pc_ref);
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
gdbarch software_single_step returns VEC (CORE_ADDR) * This patch changes gdbarch method software_single_step to return a vector of addresses on which GDB should insert breakpoints, and don't insert breakpoints. Instead, the caller of gdbarch_software_single_step inserts breakpoints if the returned vector is not NULL. gdb: 2016-11-08 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_software_single_step): Return VEC (CORE_ADDR) *. Return NULL instead of 0. Don't call insert_single_step_breakpoint. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Likewise. (alpha_software_single_step): Likewise. * alpha-tdep.h (alpha_software_single_step): Update declaration. * arm-linux-tdep.c (arm_linux_software_single_step): Return VEC (CORE_ADDR) *. Return NULL instead of 0. * arm-tdep.c (arm_software_single_step): Return NULL instead of 0. * arm-tdep.h (arm_software_single_step): Update declaration. * breakpoint.c (insert_single_step_breakpoints): New function. * breakpoint.h (insert_single_step_breakpoints): Declare. * cris-tdep.c (cris_software_single_step): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * gdbarch.sh (software_single_step): Change it to return VEC (CORE_ADDR) *. * gdbarch.c, gdbarch.h: Regenerated. * infrun.c (maybe_software_singlestep): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. (micromips_deal_with_atomic_sequence): Likewise. (deal_with_atomic_sequence): Likewise. (mips_software_single_step): Likewise. * mips-tdep.h (mips_software_single_step): Update declaration. * moxie-tdep.c (moxie_software_single_step): Likewise. * nios2-tdep.c (nios2_software_single_step): Likewise. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Update declaration. * record-full.c (record_full_resume): Adjust. (record_full_wait_1): Likewise. * rs6000-aix-tdep.c (rs6000_software_single_step): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Return VEC (CORE_ADDR) *. Don't call insert_single_step_breakpoint. * s390-linux-tdep.c (s390_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * spu-tdep.c (spu_software_single_step): Likewise. * tic6x-tdep.c (tic6x_software_single_step): Likewise.
2016-11-08 15:28:32 +01:00
return next_pcs;
Support software single step on ARM in GDBServer This patch teaches GDBServer how to software single step on ARM linux by sharing code with GDB. The arm_get_next_pcs function in GDB is now shared with GDBServer. So that GDBServer can use the function to return the possible addresses of the next PC. A proper shared context was also needed so that we could share the code, this context is described in the arm_get_next_pcs structure. Testing : No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-{native,extended} / { -marm -mthumb } gdb/ChangeLog: * Makefile.in (ALL_TARGET_OBS): Append arm-get-next-pcs.o, arm-linux.o. (ALLDEPFILES): Append arm-get-next-pcs.c, arm-linux.c (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * arch/arm-get-next-pcs.c: New file. * arch/arm-get-next-pcs.h: New file. * arch/arm-linux.h: New file. * arch/arm-linux.c: New file. * arm.c: Include common-regcache.c. (thumb_advance_itstate): Moved from arm-tdep.c. (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm.h (submask): Move macro from arm-tdep.h (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_advance_itstate): Moved declaration from arm-tdep.h (arm_instruction_changes_pc): Likewise. (thumb_instruction_changes_pc): Likewise. (thumb2_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. * arm-linux-tdep.c: Include arch/arm.h, arch/arm-get-next-pcs.h arch/arm-linux.h. (arm_linux_get_next_pcs_ops): New struct. (ARM_SIGCONTEXT_R0, ARM_UCONTEXT_SIGCONTEXT, ARM_OLD_RT_SIGFRAME_SIGINFO, ARM_OLD_RT_SIGFRAME_UCONTEXT, ARM_NEW_RT_SIGFRAME_UCONTEXT, ARM_NEW_SIGFRAME_MAGIC): Move stack layout defines to arch/arm-linux.h. (arm_linux_sigreturn_next_pc_offset): Move to arch/arm-linux.c. (arm_linux_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.c: Include arch/arm-get-next-pcs.h. (arm_get_next_pcs_ops): New struct. (submask): Move macro to arm.h. (bit): Likewise. (bits): Likewise. (sbits): Likewise. (BranchDest): Likewise. (thumb_instruction_changes_pc): Move to arm.c (thumb2_instruction_changes_pc): Likewise. (arm_instruction_changes_pc): Likewise. (shifted_reg_val): Likewise. (thumb_advance_itstate): Likewise. (thumb_get_next_pc_raw): Move to arm-get-next-pcs.c. (arm_get_next_pc_raw): Likewise. (arm_get_next_pc): Likewise. (thumb_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence_raw): Likewise. (arm_deal_with_atomic_sequence): Likewise. (arm_get_next_pcs_read_memory_unsigned_integer): New function. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_software_single_step): Adjust for arm_get_next_pcs implementation. * arm-tdep.h: (arm_get_next_pc): Remove declaration. (arm_get_next_pcs_read_memory_unsigned_integer): New declaration. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_get_next_pcs_syscall_next_pc): Likewise. (arm_get_next_pcs_is_thumb): Likewise. (arm_deal_with_atomic_sequence: Remove declaration. * common/gdb_vecs.h: Add CORE_ADDR vector definition. * configure.tgt (aarch64*-*-linux): Add arm-get-next-pcs.o, arm-linux.o. (arm*-wince-pe): Add arm-get-next-pcs.o. (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o, arm-get-next-pcs.o (arm*-*-netbsd*,arm*-*-knetbsd*-gnu): Add arm-get-next-pcs.o. (arm*-*-openbsd*): Likewise. (arm*-*-symbianelf*): Likewise. (arm*-*-*): Likewise. * symtab.h: Move CORE_ADDR vector definition to gdb_vecs.h. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Append arch/arm-linux.c, arch/arm-get-next-pcs.c. (arm-linux.o): New rule. (arm-get-next-pcs.o): New rule. * configure.srv (arm*-*-linux*): Add arm-get-next-pcs.o, arm-linux.o. * linux-aarch32-low.c (arm_abi_breakpoint): Remove macro. Moved to linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): Make non-static. * linux-aarch32-low.h (arm_abi_breakpoint): New macro. Moved from linux-aarch32-low.c. (arm_eabi_breakpoint, arm_breakpoint): Likewise. (arm_breakpoint_len, thumb_breakpoint): Likewise. (thumb_breakpoint_len, thumb2_breakpoint): Likewise. (thumb2_breakpoint_len): Likewise. (arm_is_thumb_mode): New declaration. * linux-arm-low.c: Include arch/arm-linux.h aarch/arm-get-next-pcs.h, sys/syscall.h. (get_next_pcs_ops): New struct. (get_next_pcs_addr_bits_remove): New function. (get_next_pcs_is_thumb): New function. (get_next_pcs_read_memory_unsigned_integer): Likewise. (arm_sigreturn_next_pc): Likewise. (get_next_pcs_syscall_next_pc): Likewise. (arm_gdbserver_get_next_pcs): Likewise. (struct linux_target_ops) <arm_gdbserver_get_next_pcs>: Initialize. * linux-low.h: Move CORE_ADDR vector definition to gdb_vecs.h. * server.h: Include gdb_vecs.h.
2015-12-18 17:33:59 +01:00
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
/* Cleanup/copy SVC (SWI) instructions. These two functions are overridden
for Linux, where some SVC instructions must be treated specially. */
static void
cleanup_svc (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
CORE_ADDR resume_addr = dsc->insn_addr + dsc->insn_size;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: cleanup for svc, resume at "
"%.8lx\n", (unsigned long) resume_addr);
displaced_write_reg (regs, dsc, ARM_PC_REGNUM, resume_addr, BRANCH_WRITE_PC);
}
[gdb] Fix more typos in comments Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
/* Common copy routine for svc instruction. */
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
install_svc (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
/* Preparation: none.
Insn: unmodified svc.
Cleanup: pc <- insn_addr + insn_size. */
/* Pretend we wrote to the PC, so cleanup doesn't set PC to the next
instruction. */
dsc->wrote_to_pc = 1;
/* Allow OS-specific code to override SVC handling. */
if (dsc->u.svc.copy_svc_os)
return dsc->u.svc.copy_svc_os (gdbarch, regs, dsc);
else
{
dsc->cleanup = &cleanup_svc;
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
}
static int
arm_copy_svc (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying svc insn %.8lx\n",
(unsigned long) insn);
dsc->modinsn[0] = insn;
return install_svc (gdbarch, regs, dsc);
}
static int
thumb_copy_svc (struct gdbarch *gdbarch, uint16_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying svc insn %.4x\n",
insn);
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
dsc->modinsn[0] = insn;
return install_svc (gdbarch, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* Copy undefined instructions. */
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_copy_undef (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
if (debug_displaced)
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
fprintf_unfiltered (gdb_stdlog,
"displaced: copying undefined insn %.8lx\n",
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
(unsigned long) insn);
dsc->modinsn[0] = insn;
return 0;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb_32bit_copy_undef (struct gdbarch *gdbarch, uint16_t insn1, uint16_t insn2,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying undefined insn "
"%.4x %.4x\n", (unsigned short) insn1,
(unsigned short) insn2);
dsc->modinsn[0] = insn1;
dsc->modinsn[1] = insn2;
dsc->numinsns = 2;
return 0;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Copy unpredictable instructions. */
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_copy_unpred (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying unpredictable insn "
"%.8lx\n", (unsigned long) insn);
dsc->modinsn[0] = insn;
return 0;
}
/* The decode_* functions are instruction decoding helpers. They mostly follow
the presentation in the ARM ARM. */
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_decode_misc_memhint_neon (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int op1 = bits (insn, 20, 26), op2 = bits (insn, 4, 7);
unsigned int rn = bits (insn, 16, 19);
if (op1 == 0x10 && (op2 & 0x2) == 0x0 && (rn & 0x1) == 0x0)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "cps", dsc);
else if (op1 == 0x10 && op2 == 0x0 && (rn & 0x1) == 0x1)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "setend", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x60) == 0x20)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "neon dataproc", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x71) == 0x40)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "neon elt/struct load/store",
dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x77) == 0x41)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "unallocated mem hint", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x77) == 0x45)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_preload (gdbarch, insn, regs, dsc); /* pli. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x77) == 0x51)
{
if (rn != 0xf)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_preload (gdbarch, insn, regs, dsc); /* pld/pldw. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unpred (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else if ((op1 & 0x77) == 0x55)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_preload (gdbarch, insn, regs, dsc); /* pld/pldw. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if (op1 == 0x57)
switch (op2)
{
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
case 0x1: return arm_copy_unmodified (gdbarch, insn, "clrex", dsc);
case 0x4: return arm_copy_unmodified (gdbarch, insn, "dsb", dsc);
case 0x5: return arm_copy_unmodified (gdbarch, insn, "dmb", dsc);
case 0x6: return arm_copy_unmodified (gdbarch, insn, "isb", dsc);
default: return arm_copy_unpred (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else if ((op1 & 0x63) == 0x43)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unpred (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op2 & 0x1) == 0x0)
switch (op1 & ~0x80)
{
case 0x61:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "unallocated mem hint", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x65:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_preload_reg (gdbarch, insn, regs, dsc); /* pli reg. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x71: case 0x75:
/* pld/pldw reg. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_preload_reg (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x63: case 0x67: case 0x73: case 0x77:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unpred (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
default:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc); /* Probably unreachable. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_decode_unconditional (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
if (bit (insn, 27) == 0)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_decode_misc_memhint_neon (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Switch on bits: 0bxxxxx321xxx0xxxxxxxxxxxxxxxxxxxx. */
else switch (((insn & 0x7000000) >> 23) | ((insn & 0x100000) >> 20))
{
case 0x0: case 0x2:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "srs", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x1: case 0x3:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "rfe", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x4: case 0x5: case 0x6: case 0x7:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_b_bl_blx (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x8:
switch ((insn & 0xe00000) >> 21)
{
case 0x1: case 0x3: case 0x4: case 0x5: case 0x6: case 0x7:
/* stc/stc2. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x2:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mcrr/mcrr2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
default:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
case 0x9:
{
int rn_f = (bits (insn, 16, 19) == 0xf);
switch ((insn & 0xe00000) >> 21)
{
case 0x1: case 0x3:
/* ldc/ldc2 imm (undefined for rn == pc). */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return rn_f ? arm_copy_undef (gdbarch, insn, dsc)
: arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x2:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mrrc/mrrc2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x4: case 0x5: case 0x6: case 0x7:
/* ldc/ldc2 lit (undefined for rn != pc). */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return rn_f ? arm_copy_copro_load_store (gdbarch, insn, regs, dsc)
: arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
default:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
}
case 0xa:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "stc/stc2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0xb:
if (bits (insn, 16, 19) == 0xf)
/* ldc/ldc2 lit. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0xc:
if (bit (insn, 4))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mcr/mcr2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "cdp/cdp2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0xd:
if (bit (insn, 4))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mrc/mrc2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "cdp/cdp2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
default:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
}
/* Decode miscellaneous instructions in dp/misc encoding space. */
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_decode_miscellaneous (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int op2 = bits (insn, 4, 6);
unsigned int op = bits (insn, 21, 22);
switch (op2)
{
case 0x0:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mrs/msr", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x1:
if (op == 0x1) /* bx. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_bx_blx_reg (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if (op == 0x3)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "clz", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x2:
if (op == 0x1)
/* Not really supported. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "bxj", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x3:
if (op == 0x1)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_bx_blx_reg (gdbarch, insn,
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
regs, dsc); /* blx register. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x5:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "saturating add/sub", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x7:
if (op == 0x1)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "bkpt", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if (op == 0x3)
/* Not really supported. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "smc", dsc);
Fix "fall through" comments This patch updates existing "fall through" comments so that they can be recognized by gcc's -Wimplicit-fallthrough comment-parsing heuristic. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * s390-tdep.c (s390_process_record): Fix fall-through comments. * xcoffread.c (scan_xcoff_symtab): Move comment later. * symfile.c (section_is_mapped): Fix fall-through comment. * stabsread.c (define_symbol, read_member_functions): Fix fall-through comment. * s390-linux-tdep.c (s390_process_record): Fix fall-through comment. * remote.c (remote_wait_as): Fix fall-through comment. * p-exp.y (yylex): Fix fall-through comment. * nat/x86-dregs.c (x86_length_and_rw_bits): Fix fall-through comment. * msp430-tdep.c (msp430_gdbarch_init): Fix fall-through comment. * mdebugread.c (parse_partial_symbols): Fix fall-through comment. * jv-exp.y (yylex): Fix fall-through comment. * go-exp.y (lex_one_token): Fix fall-through comment. * gdbtypes.c (get_discrete_bounds, rank_one_type): Fix fall-through comment. * f-exp.y (yylex): Fix fall-through comment. * dwarf2read.c (process_die): Fix fall-through comments. * dbxread.c (process_one_symbol): Fix fall-through comment. * d-exp.y (lex_one_token): Fix fall-through comment. * cp-name-parser.y (yylex): Fix fall-through comment. * coffread.c (coff_symtab_read): Fix fall-through comment. * c-exp.y (lex_one_token): Fix fall-through comment. * arm-tdep.c (arm_decode_miscellaneous): Fix fall-through comment. * arch/arm.c (arm_instruction_changes_pc): Fix fall-through comment.
2016-09-27 19:18:04 +02:00
/* Fall through. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
default:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
}
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_decode_dp_misc (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
if (bit (insn, 25))
switch (bits (insn, 20, 24))
{
case 0x10:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "movw", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x14:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "movt", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x12: case 0x16:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "msr imm", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
default:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_alu_imm (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else
{
uint32_t op1 = bits (insn, 20, 24), op2 = bits (insn, 4, 7);
if ((op1 & 0x19) != 0x10 && (op2 & 0x1) == 0x0)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_alu_reg (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x19) != 0x10 && (op2 & 0x9) == 0x1)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_alu_shifted_reg (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x19) == 0x10 && (op2 & 0x8) == 0x0)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_decode_miscellaneous (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x19) == 0x10 && (op2 & 0x9) == 0x8)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "halfword mul/mla", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x10) == 0x00 && op2 == 0x9)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mul/mla", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x10) == 0x10 && op2 == 0x9)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "synch", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if (op2 == 0xb || (op2 & 0xd) == 0xd)
/* 2nd arg means "unprivileged". */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_extra_ld_st (gdbarch, insn, (op1 & 0x12) == 0x02, regs,
dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* Should be unreachable. */
return 1;
}
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_decode_ld_st_word_ubyte (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
int a = bit (insn, 25), b = bit (insn, 4);
uint32_t op1 = bits (insn, 20, 24);
if ((!a && (op1 & 0x05) == 0x00 && (op1 & 0x17) != 0x02)
|| (a && (op1 & 0x05) == 0x00 && (op1 & 0x17) != 0x02 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 4, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((!a && (op1 & 0x17) == 0x02)
|| (a && (op1 & 0x17) == 0x02 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 4, 1);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((!a && (op1 & 0x05) == 0x01 && (op1 & 0x17) != 0x03)
|| (a && (op1 & 0x05) == 0x01 && (op1 & 0x17) != 0x03 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 4, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((!a && (op1 & 0x17) == 0x03)
|| (a && (op1 & 0x17) == 0x03 && !b))
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 4, 1);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((!a && (op1 & 0x05) == 0x04 && (op1 & 0x17) != 0x06)
|| (a && (op1 & 0x05) == 0x04 && (op1 & 0x17) != 0x06 && !b))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 1, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((!a && (op1 & 0x17) == 0x06)
|| (a && (op1 & 0x17) == 0x06 && !b))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 0, 1, 1);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((!a && (op1 & 0x05) == 0x05 && (op1 & 0x17) != 0x07)
|| (a && (op1 & 0x05) == 0x05 && (op1 & 0x17) != 0x07 && !b))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 1, 0);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((!a && (op1 & 0x17) == 0x07)
|| (a && (op1 & 0x17) == 0x07 && !b))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_ldr_str_ldrb_strb (gdbarch, insn, regs, dsc, 1, 1, 1);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Should be unreachable. */
return 1;
}
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_decode_media (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
switch (bits (insn, 20, 24))
{
case 0x00: case 0x01: case 0x02: case 0x03:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "parallel add/sub signed", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x04: case 0x05: case 0x06: case 0x07:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "parallel add/sub unsigned", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x08: case 0x09: case 0x0a: case 0x0b:
case 0x0c: case 0x0d: case 0x0e: case 0x0f:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn,
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
"decode/pack/unpack/saturate/reverse", dsc);
case 0x18:
if (bits (insn, 5, 7) == 0) /* op2. */
{
if (bits (insn, 12, 15) == 0xf)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "usad8", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "usada8", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x1a: case 0x1b:
if (bits (insn, 5, 6) == 0x2) /* op2[1:0]. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "sbfx", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x1c: case 0x1d:
if (bits (insn, 5, 6) == 0x0) /* op2[1:0]. */
{
if (bits (insn, 0, 3) == 0xf)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "bfc", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "bfi", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x1e: case 0x1f:
if (bits (insn, 5, 6) == 0x2) /* op2[1:0]. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "ubfx", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* Should be unreachable. */
return 1;
}
static int
arm_decode_b_bl_ldmstm (struct gdbarch *gdbarch, uint32_t insn,
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
if (bit (insn, 25))
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_b_bl_blx (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_block_xfer (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
static int
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
arm_decode_ext_reg_ld_st (struct gdbarch *gdbarch, uint32_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int opcode = bits (insn, 20, 24);
switch (opcode)
{
case 0x04: case 0x05: /* VFP/Neon mrrc/mcrr. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "vfp/neon mrrc/mcrr", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x08: case 0x0a: case 0x0c: case 0x0e:
case 0x12: case 0x16:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "vfp/neon vstm/vpush", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x09: case 0x0b: case 0x0d: case 0x0f:
case 0x13: case 0x17:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "vfp/neon vldm/vpop", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
case 0x10: case 0x14: case 0x18: case 0x1c: /* vstr. */
case 0x11: case 0x15: case 0x19: case 0x1d: /* vldr. */
/* Note: no writeback for these instructions. Bit 25 will always be
zero though (via caller), so the following works OK. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* Should be unreachable. */
return 1;
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
/* Decode shifted register instructions. */
static int
thumb2_decode_dp_shift_reg (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
/* PC is only allowed to be used in instruction MOV. */
unsigned int op = bits (insn1, 5, 8);
unsigned int rn = bits (insn1, 0, 3);
if (op == 0x2 && rn == 0xf) /* MOV */
return thumb2_copy_alu_imm (gdbarch, insn1, insn2, regs, dsc);
else
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"dp (shift reg)", dsc);
}
/* Decode extension register load/store. Exactly the same as
arm_decode_ext_reg_ld_st. */
static int
thumb2_decode_ext_reg_ld_st (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int opcode = bits (insn1, 4, 8);
switch (opcode)
{
case 0x04: case 0x05:
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"vfp/neon vmov", dsc);
case 0x08: case 0x0c: /* 01x00 */
case 0x0a: case 0x0e: /* 01x10 */
case 0x12: case 0x16: /* 10x10 */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"vfp/neon vstm/vpush", dsc);
case 0x09: case 0x0d: /* 01x01 */
case 0x0b: case 0x0f: /* 01x11 */
case 0x13: case 0x17: /* 10x11 */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"vfp/neon vldm/vpop", dsc);
case 0x10: case 0x14: case 0x18: case 0x1c: /* vstr. */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"vstr", dsc);
case 0x11: case 0x15: case 0x19: case 0x1d: /* vldr. */
return thumb2_copy_copro_load_store (gdbarch, insn1, insn2, regs, dsc);
}
/* Should be unreachable. */
return 1;
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
static int
arm_decode_svc_copro (struct gdbarch *gdbarch, uint32_t insn,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct regcache *regs, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
unsigned int op1 = bits (insn, 20, 25);
int op = bit (insn, 4);
unsigned int coproc = bits (insn, 8, 11);
if ((op1 & 0x20) == 0x00 && (op1 & 0x3a) != 0x00 && (coproc & 0xe) == 0xa)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_decode_ext_reg_ld_st (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x21) == 0x00 && (op1 & 0x3a) != 0x00
&& (coproc & 0xe) != 0xa)
/* stc/stc2. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x21) == 0x01 && (op1 & 0x3a) != 0x00
&& (coproc & 0xe) != 0xa)
/* ldc/ldc2 imm/lit. */
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_copro_load_store (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x3e) == 0x00)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x3e) == 0x04 && (coproc & 0xe) == 0xa)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "neon 64bit xfer", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if (op1 == 0x04 && (coproc & 0xe) != 0xa)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mcrr/mcrr2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if (op1 == 0x05 && (coproc & 0xe) != 0xa)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mrrc/mrrc2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x30) == 0x20 && !op)
{
if ((coproc & 0xe) == 0xa)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "vfp dataproc", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "cdp/cdp2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else if ((op1 & 0x30) == 0x20 && op)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "neon 8/16/32 bit xfer", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x31) == 0x20 && op && (coproc & 0xe) != 0xa)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mcr/mcr2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x31) == 0x21 && op && (coproc & 0xe) != 0xa)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_unmodified (gdbarch, insn, "mrc/mrc2", dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else if ((op1 & 0x30) == 0x30)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_svc (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
return arm_copy_undef (gdbarch, insn, dsc); /* Possibly unreachable. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb2_decode_svc_copro (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int coproc = bits (insn2, 8, 11);
unsigned int bit_5_8 = bits (insn1, 5, 8);
unsigned int bit_9 = bit (insn1, 9);
unsigned int bit_4 = bit (insn1, 4);
if (bit_9 == 0)
{
if (bit_5_8 == 2)
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"neon 64bit xfer/mrrc/mrrc2/mcrr/mcrr2",
dsc);
else if (bit_5_8 == 0) /* UNDEFINED. */
return thumb_32bit_copy_undef (gdbarch, insn1, insn2, dsc);
else
{
/*coproc is 101x. SIMD/VFP, ext registers load/store. */
if ((coproc & 0xe) == 0xa)
return thumb2_decode_ext_reg_ld_st (gdbarch, insn1, insn2, regs,
dsc);
else /* coproc is not 101x. */
{
if (bit_4 == 0) /* STC/STC2. */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"stc/stc2", dsc);
else /* LDC/LDC2 {literal, immediate}. */
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
return thumb2_copy_copro_load_store (gdbarch, insn1, insn2,
regs, dsc);
}
}
}
else
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2, "coproc", dsc);
return 0;
}
static void
install_pc_relative (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc, int rd)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
/* ADR Rd, #imm
Rewrite as:
Preparation: Rd <- PC
Insn: ADD Rd, #imm
Cleanup: Null.
*/
/* Rd <- PC */
int val = displaced_read_reg (regs, dsc, ARM_PC_REGNUM);
displaced_write_reg (regs, dsc, rd, val, CANNOT_WRITE_PC);
}
static int
thumb_copy_pc_relative_16bit (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc,
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
int rd, unsigned int imm)
{
/* Encoding T2: ADDS Rd, #imm */
dsc->modinsn[0] = (0x3000 | (rd << 8) | imm);
install_pc_relative (gdbarch, regs, dsc, rd);
return 0;
}
static int
thumb_decode_pc_relative_16bit (struct gdbarch *gdbarch, uint16_t insn,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int rd = bits (insn, 8, 10);
unsigned int imm8 = bits (insn, 0, 7);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying thumb adr r%d, #%d insn %.4x\n",
rd, imm8, insn);
return thumb_copy_pc_relative_16bit (gdbarch, regs, dsc, rd, imm8);
}
static int
thumb_copy_pc_relative_32bit (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int rd = bits (insn2, 8, 11);
/* Since immediate has the same encoding in ADR ADD and SUB, so we simply
extract raw immediate encoding rather than computing immediate. When
generating ADD or SUB instruction, we can simply perform OR operation to
set immediate into ADD. */
unsigned int imm_3_8 = insn2 & 0x70ff;
unsigned int imm_i = insn1 & 0x0400; /* Clear all bits except bit 10. */
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying thumb adr r%d, #%d:%d insn %.4x%.4x\n",
rd, imm_i, imm_3_8, insn1, insn2);
if (bit (insn1, 7)) /* Encoding T2 */
{
/* Encoding T3: SUB Rd, Rd, #imm */
dsc->modinsn[0] = (0xf1a0 | rd | imm_i);
dsc->modinsn[1] = ((rd << 8) | imm_3_8);
}
else /* Encoding T3 */
{
/* Encoding T3: ADD Rd, Rd, #imm */
dsc->modinsn[0] = (0xf100 | rd | imm_i);
dsc->modinsn[1] = ((rd << 8) | imm_3_8);
}
dsc->numinsns = 2;
install_pc_relative (gdbarch, regs, dsc, rd);
return 0;
}
static int
thumb_copy_16bit_ldr_literal (struct gdbarch *gdbarch, uint16_t insn1,
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned int rt = bits (insn1, 8, 10);
unsigned int pc;
int imm8 = (bits (insn1, 0, 7) << 2);
/* LDR Rd, #imm8
Rwrite as:
Preparation: tmp0 <- R0, tmp2 <- R2, tmp3 <- R3, R2 <- PC, R3 <- #imm8;
Insn: LDR R0, [R2, R3];
Cleanup: R2 <- tmp2, R3 <- tmp3, Rd <- R0, R0 <- tmp0 */
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying thumb ldr r%d [pc #%d]\n"
, rt, imm8);
dsc->tmp[0] = displaced_read_reg (regs, dsc, 0);
dsc->tmp[2] = displaced_read_reg (regs, dsc, 2);
dsc->tmp[3] = displaced_read_reg (regs, dsc, 3);
pc = displaced_read_reg (regs, dsc, ARM_PC_REGNUM);
/* The assembler calculates the required value of the offset from the
Align(PC,4) value of this instruction to the label. */
pc = pc & 0xfffffffc;
displaced_write_reg (regs, dsc, 2, pc, CANNOT_WRITE_PC);
displaced_write_reg (regs, dsc, 3, imm8, CANNOT_WRITE_PC);
dsc->rd = rt;
dsc->u.ldst.xfersize = 4;
dsc->u.ldst.rn = 0;
dsc->u.ldst.immed = 0;
dsc->u.ldst.writeback = 0;
dsc->u.ldst.restore_r4 = 0;
dsc->modinsn[0] = 0x58d0; /* ldr r0, [r2, r3]*/
dsc->cleanup = &cleanup_load;
return 0;
}
/* Copy Thumb cbnz/cbz instruction. */
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
static int
thumb_copy_cbnz_cbz (struct gdbarch *gdbarch, uint16_t insn1,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
int non_zero = bit (insn1, 11);
unsigned int imm5 = (bit (insn1, 9) << 6) | (bits (insn1, 3, 7) << 1);
CORE_ADDR from = dsc->insn_addr;
int rn = bits (insn1, 0, 2);
int rn_val = displaced_read_reg (regs, dsc, rn);
dsc->u.branch.cond = (rn_val && non_zero) || (!rn_val && !non_zero);
/* CBNZ and CBZ do not affect the condition flags. If condition is true,
set it INST_AL, so cleanup_branch will know branch is taken, otherwise,
condition is false, let it be, cleanup_branch will do nothing. */
if (dsc->u.branch.cond)
{
dsc->u.branch.cond = INST_AL;
dsc->u.branch.dest = from + 4 + imm5;
}
else
dsc->u.branch.dest = from + 2;
dsc->u.branch.link = 0;
dsc->u.branch.exchange = 0;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copying %s [r%d = 0x%x]"
" insn %.4x to %.8lx\n", non_zero ? "cbnz" : "cbz",
rn, rn_val, insn1, dsc->u.branch.dest);
dsc->modinsn[0] = THUMB_NOP;
dsc->cleanup = &cleanup_branch;
return 0;
}
/* Copy Table Branch Byte/Halfword */
static int
thumb2_copy_table_branch (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
ULONGEST rn_val, rm_val;
int is_tbh = bit (insn2, 4);
CORE_ADDR halfwords = 0;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
rn_val = displaced_read_reg (regs, dsc, bits (insn1, 0, 3));
rm_val = displaced_read_reg (regs, dsc, bits (insn2, 0, 3));
if (is_tbh)
{
gdb_byte buf[2];
target_read_memory (rn_val + 2 * rm_val, buf, 2);
halfwords = extract_unsigned_integer (buf, 2, byte_order);
}
else
{
gdb_byte buf[1];
target_read_memory (rn_val + rm_val, buf, 1);
halfwords = extract_unsigned_integer (buf, 1, byte_order);
}
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: %s base 0x%x offset 0x%x"
" offset 0x%x\n", is_tbh ? "tbh" : "tbb",
(unsigned int) rn_val, (unsigned int) rm_val,
(unsigned int) halfwords);
dsc->u.branch.cond = INST_AL;
dsc->u.branch.link = 0;
dsc->u.branch.exchange = 0;
dsc->u.branch.dest = dsc->insn_addr + 4 + 2 * halfwords;
dsc->cleanup = &cleanup_branch;
return 0;
}
static void
cleanup_pop_pc_16bit_all (struct gdbarch *gdbarch, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
/* PC <- r7 */
int val = displaced_read_reg (regs, dsc, 7);
displaced_write_reg (regs, dsc, ARM_PC_REGNUM, val, BX_WRITE_PC);
/* r7 <- r8 */
val = displaced_read_reg (regs, dsc, 8);
displaced_write_reg (regs, dsc, 7, val, CANNOT_WRITE_PC);
/* r8 <- tmp[0] */
displaced_write_reg (regs, dsc, 8, dsc->tmp[0], CANNOT_WRITE_PC);
}
static int
thumb_copy_pop_pc_16bit (struct gdbarch *gdbarch, uint16_t insn1,
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
dsc->u.block.regmask = insn1 & 0x00ff;
/* Rewrite instruction: POP {rX, rY, ...,rZ, PC}
to :
(1) register list is full, that is, r0-r7 are used.
Prepare: tmp[0] <- r8
POP {r0, r1, ...., r6, r7}; remove PC from reglist
MOV r8, r7; Move value of r7 to r8;
POP {r7}; Store PC value into r7.
Cleanup: PC <- r7, r7 <- r8, r8 <-tmp[0]
(2) register list is not full, supposing there are N registers in
register list (except PC, 0 <= N <= 7).
Prepare: for each i, 0 - N, tmp[i] <- ri.
POP {r0, r1, ...., rN};
Cleanup: Set registers in original reglist from r0 - rN. Restore r0 - rN
from tmp[] properly.
*/
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog,
"displaced: copying thumb pop {%.8x, pc} insn %.4x\n",
dsc->u.block.regmask, insn1);
if (dsc->u.block.regmask == 0xff)
{
dsc->tmp[0] = displaced_read_reg (regs, dsc, 8);
dsc->modinsn[0] = (insn1 & 0xfeff); /* POP {r0,r1,...,r6, r7} */
dsc->modinsn[1] = 0x46b8; /* MOV r8, r7 */
dsc->modinsn[2] = 0xbc80; /* POP {r7} */
dsc->numinsns = 3;
dsc->cleanup = &cleanup_pop_pc_16bit_all;
}
else
{
gnulib: import count-one-bits module and use it For a fix I intend to submit, I would need a function that counts the number of set bits in a word. There is __builtin_popcount that is supported by gcc and clang, but there is also a gnulib module that wraps that and provides a fallback for other compilers, so I think it would be good to use it. I also noticed that there is a bitcount function in arch/arm.c, so I thought that as a first step I would replace that one with the gnulib count-one-bits module. This is what this patch does. The gnulib module provides multiple functions, with various parameter length (unsigned int, unsigned long int, unsigned long long int), I chose the one that made sense for each call site based on the argument type. gnulib/ChangeLog: * update-gnulib.sh (IMPORTED_GNULIB_MODULES): Import count-one-bits module. * configure: Re-generate. * aclocal.m4: Re-generate. * Makefile.in: Re-generate. * import/count-one-bits.c: New file. * import/count-one-bits.h: New file. * import/Makefile.am: Re-generate. * import/Makefile.in: Re-generate. * import/m4/gnulib-cache.m4: Re-generate. * import/m4/gnulib-comp.m4: Re-generate. * import/m4/count-one-bits.m4: New file. gdb/ChangeLog: * arm-tdep.c: Include count-one-bits.h. (cleanup_block_store_pc): Use count_one_bits. (cleanup_block_load_pc): Use count_one_bits. (arm_copy_block_xfer): Use count_one_bits. (thumb2_copy_block_xfer): Use count_one_bits. (thumb_copy_pop_pc_16bit): Use count_one_bits. * arch/arm-get-next-pcs.c: Include count-one-bits.h. (thumb_get_next_pcs_raw): Use count_one_bits. (arm_get_next_pcs_raw): Use count_one_bits_l. * arch/arm.c (bitcount): Remove. * arch/arm.h (bitcount): Remove.
2020-02-14 20:41:07 +01:00
unsigned int num_in_list = count_one_bits (dsc->u.block.regmask);
unsigned int i;
unsigned int new_regmask;
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
for (i = 0; i < num_in_list + 1; i++)
dsc->tmp[i] = displaced_read_reg (regs, dsc, i);
new_regmask = (1 << (num_in_list + 1)) - 1;
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, _("displaced: POP "
"{..., pc}: original reg list %.4x,"
" modified list %.4x\n"),
(int) dsc->u.block.regmask, new_regmask);
dsc->u.block.regmask |= 0x8000;
dsc->u.block.writeback = 0;
dsc->u.block.cond = INST_AL;
dsc->modinsn[0] = (insn1 & ~0x1ff) | (new_regmask & 0xff);
dsc->cleanup = &cleanup_block_load_pc;
}
return 0;
}
static void
thumb_process_displaced_16bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
unsigned short op_bit_12_15 = bits (insn1, 12, 15);
unsigned short op_bit_10_11 = bits (insn1, 10, 11);
int err = 0;
/* 16-bit thumb instructions. */
switch (op_bit_12_15)
{
/* Shift (imme), add, subtract, move and compare. */
case 0: case 1: case 2: case 3:
err = thumb_copy_unmodified_16bit (gdbarch, insn1,
"shift/add/sub/mov/cmp",
dsc);
break;
case 4:
switch (op_bit_10_11)
{
case 0: /* Data-processing */
err = thumb_copy_unmodified_16bit (gdbarch, insn1,
"data-processing",
dsc);
break;
case 1: /* Special data instructions and branch and exchange. */
{
unsigned short op = bits (insn1, 7, 9);
if (op == 6 || op == 7) /* BX or BLX */
err = thumb_copy_bx_blx_reg (gdbarch, insn1, regs, dsc);
else if (bits (insn1, 6, 7) != 0) /* ADD/MOV/CMP high registers. */
err = thumb_copy_alu_reg (gdbarch, insn1, regs, dsc);
else
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "special data",
dsc);
}
break;
default: /* LDR (literal) */
err = thumb_copy_16bit_ldr_literal (gdbarch, insn1, regs, dsc);
}
break;
case 5: case 6: case 7: case 8: case 9: /* Load/Store single data item */
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "ldr/str", dsc);
break;
case 10:
if (op_bit_10_11 < 2) /* Generate PC-relative address */
err = thumb_decode_pc_relative_16bit (gdbarch, insn1, regs, dsc);
else /* Generate SP-relative address */
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "sp-relative", dsc);
break;
case 11: /* Misc 16-bit instructions */
{
switch (bits (insn1, 8, 11))
{
case 1: case 3: case 9: case 11: /* CBNZ, CBZ */
err = thumb_copy_cbnz_cbz (gdbarch, insn1, regs, dsc);
break;
case 12: case 13: /* POP */
if (bit (insn1, 8)) /* PC is in register list. */
err = thumb_copy_pop_pc_16bit (gdbarch, insn1, regs, dsc);
else
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "pop", dsc);
break;
case 15: /* If-Then, and hints */
if (bits (insn1, 0, 3))
/* If-Then makes up to four following instructions conditional.
IT instruction itself is not conditional, so handle it as a
common unmodified instruction. */
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "If-Then",
dsc);
else
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "hints", dsc);
break;
default:
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "misc", dsc);
}
}
break;
case 12:
if (op_bit_10_11 < 2) /* Store multiple registers */
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "stm", dsc);
else /* Load multiple registers */
err = thumb_copy_unmodified_16bit (gdbarch, insn1, "ldm", dsc);
break;
case 13: /* Conditional branch and supervisor call */
if (bits (insn1, 9, 11) != 7) /* conditional branch */
err = thumb_copy_b (gdbarch, insn1, dsc);
else
err = thumb_copy_svc (gdbarch, insn1, regs, dsc);
break;
case 14: /* Unconditional branch */
err = thumb_copy_b (gdbarch, insn1, dsc);
break;
default:
err = 1;
}
if (err)
internal_error (__FILE__, __LINE__,
_("thumb_process_displaced_16bit_insn: Instruction decode error"));
}
static int
decode_thumb_32bit_ld_mem_hints (struct gdbarch *gdbarch,
uint16_t insn1, uint16_t insn2,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
int rt = bits (insn2, 12, 15);
int rn = bits (insn1, 0, 3);
int op1 = bits (insn1, 7, 8);
switch (bits (insn1, 5, 6))
{
case 0: /* Load byte and memory hints */
if (rt == 0xf) /* PLD/PLI */
{
if (rn == 0xf)
/* PLD literal or Encoding T3 of PLI(immediate, literal). */
return thumb2_copy_preload (gdbarch, insn1, insn2, regs, dsc);
else
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"pli/pld", dsc);
}
else
{
if (rn == 0xf) /* LDRB/LDRSB (literal) */
return thumb2_copy_load_literal (gdbarch, insn1, insn2, regs, dsc,
1);
else
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"ldrb{reg, immediate}/ldrbt",
dsc);
}
break;
case 1: /* Load halfword and memory hints. */
if (rt == 0xf) /* PLD{W} and Unalloc memory hint. */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"pld/unalloc memhint", dsc);
else
{
if (rn == 0xf)
return thumb2_copy_load_literal (gdbarch, insn1, insn2, regs, dsc,
2);
else
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"ldrh/ldrht", dsc);
}
break;
case 2: /* Load word */
{
int insn2_bit_8_11 = bits (insn2, 8, 11);
if (rn == 0xf)
return thumb2_copy_load_literal (gdbarch, insn1, insn2, regs, dsc, 4);
else if (op1 == 0x1) /* Encoding T3 */
return thumb2_copy_load_reg_imm (gdbarch, insn1, insn2, regs, dsc,
0, 1);
else /* op1 == 0x0 */
{
if (insn2_bit_8_11 == 0xc || (insn2_bit_8_11 & 0x9) == 0x9)
/* LDR (immediate) */
return thumb2_copy_load_reg_imm (gdbarch, insn1, insn2, regs,
dsc, bit (insn2, 8), 1);
else if (insn2_bit_8_11 == 0xe) /* LDRT */
return thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"ldrt", dsc);
else
/* LDR (register) */
return thumb2_copy_load_reg_imm (gdbarch, insn1, insn2, regs,
dsc, 0, 0);
}
break;
}
default:
return thumb_32bit_copy_undef (gdbarch, insn1, insn2, dsc);
break;
}
return 0;
}
static void
thumb_process_displaced_32bit_insn (struct gdbarch *gdbarch, uint16_t insn1,
uint16_t insn2, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
{
int err = 0;
unsigned short op = bit (insn2, 15);
unsigned int op1 = bits (insn1, 11, 12);
switch (op1)
{
case 1:
{
switch (bits (insn1, 9, 10))
{
case 0:
if (bit (insn1, 6))
{
/* Load/store {dual, exclusive}, table branch. */
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
if (bits (insn1, 7, 8) == 1 && bits (insn1, 4, 5) == 1
&& bits (insn2, 5, 7) == 0)
err = thumb2_copy_table_branch (gdbarch, insn1, insn2, regs,
dsc);
else
/* PC is not allowed to use in load/store {dual, exclusive}
instructions. */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"load/store dual/ex", dsc);
}
else /* load/store multiple */
{
switch (bits (insn1, 7, 8))
{
case 0: case 3: /* SRS, RFE */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"srs/rfe", dsc);
break;
case 1: case 2: /* LDM/STM/PUSH/POP */
err = thumb2_copy_block_xfer (gdbarch, insn1, insn2, regs, dsc);
break;
}
}
break;
case 1:
/* Data-processing (shift register). */
err = thumb2_decode_dp_shift_reg (gdbarch, insn1, insn2, regs,
dsc);
break;
default: /* Coprocessor instructions. */
err = thumb2_decode_svc_copro (gdbarch, insn1, insn2, regs, dsc);
break;
}
break;
}
case 2: /* op1 = 2 */
if (op) /* Branch and misc control. */
{
if (bit (insn2, 14) /* BLX/BL */
|| bit (insn2, 12) /* Unconditional branch */
|| (bits (insn1, 7, 9) != 0x7)) /* Conditional branch */
err = thumb2_copy_b_bl_blx (gdbarch, insn1, insn2, regs, dsc);
else
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"misc ctrl", dsc);
}
else
{
if (bit (insn1, 9)) /* Data processing (plain binary imm). */
{
Simple -Wshadow=local fixes This fixes all the straightforward -Wshadow=local warnings in gdb. A few standard approaches are used here: * Renaming an inner (or outer, but more commonly inner) variable; * Lowering a declaration to avoid a clash; * Moving a declaration into a more inner scope to avoid a clash, including the special case of moving a declaration into a loop header. I did not consider any of the changes in this patch to be particularly noteworthy, though of course they should all still be examined. gdb/ChangeLog 2018-10-04 Tom Tromey <tom@tromey.com> * ctf.c (SET_ARRAY_FIELD): Rename "u32". * p-valprint.c (pascal_val_print): Split inner "i" variable. * xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop header. * xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in more inner scope. * xcoffread.c (read_xcoff_symtab): Rename inner "symbol". * varobj.c (varobj_update): Rename inner "newobj", "type_changed". * valprint.c (generic_emit_char): Rename inner "buf". * valops.c (find_overload_match): Rename inner "temp". (value_struct_elt_for_reference): Declare "v" in more inner scope. * v850-tdep.c (v850_push_dummy_call): Rename "len". * unittests/array-view-selftests.c (run_tests): Rename inner "vec". * tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop header. * tracepoint.c (merge_uploaded_trace_state_variables): Declare "tsv" in more inner scope. (print_one_static_tracepoint_marker): Rename inner "tuple_emitter". * tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower. (tic6x_push_dummy_call): Don't redeclare "addr". * target-float.c: Declare "dto" lower. * symtab.c (lookup_local_symbol): Rename inner "sym". (find_pc_sect_line): Rename inner "pc". * stack.c (print_frame): Don't redeclare "gdbarch". (return_command): Rename inner "gdbarch". * s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner "sp". * rust-lang.c (rust_internal_print_type): Declare "i" in loop header. * rs6000-tdep.c (ppc_process_record): Rename inner "addr". * riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner scope. * remote.c (remote_target::update_thread_list): Don't redeclare "tp". (remote_target::process_initial_stop_replies): Rename inner "thread". (remote_target::remote_parse_stop_reply): Don't redeclare "p". (remote_target::wait_as): Don't redeclare "stop_reply". (remote_target::get_thread_local_address): Rename inner "result". (remote_target::get_tib_address): Likewise.
2018-04-22 00:16:27 +02:00
int dp_op = bits (insn1, 4, 8);
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
int rn = bits (insn1, 0, 3);
Simple -Wshadow=local fixes This fixes all the straightforward -Wshadow=local warnings in gdb. A few standard approaches are used here: * Renaming an inner (or outer, but more commonly inner) variable; * Lowering a declaration to avoid a clash; * Moving a declaration into a more inner scope to avoid a clash, including the special case of moving a declaration into a loop header. I did not consider any of the changes in this patch to be particularly noteworthy, though of course they should all still be examined. gdb/ChangeLog 2018-10-04 Tom Tromey <tom@tromey.com> * ctf.c (SET_ARRAY_FIELD): Rename "u32". * p-valprint.c (pascal_val_print): Split inner "i" variable. * xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop header. * xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in more inner scope. * xcoffread.c (read_xcoff_symtab): Rename inner "symbol". * varobj.c (varobj_update): Rename inner "newobj", "type_changed". * valprint.c (generic_emit_char): Rename inner "buf". * valops.c (find_overload_match): Rename inner "temp". (value_struct_elt_for_reference): Declare "v" in more inner scope. * v850-tdep.c (v850_push_dummy_call): Rename "len". * unittests/array-view-selftests.c (run_tests): Rename inner "vec". * tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop header. * tracepoint.c (merge_uploaded_trace_state_variables): Declare "tsv" in more inner scope. (print_one_static_tracepoint_marker): Rename inner "tuple_emitter". * tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower. (tic6x_push_dummy_call): Don't redeclare "addr". * target-float.c: Declare "dto" lower. * symtab.c (lookup_local_symbol): Rename inner "sym". (find_pc_sect_line): Rename inner "pc". * stack.c (print_frame): Don't redeclare "gdbarch". (return_command): Rename inner "gdbarch". * s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner "sp". * rust-lang.c (rust_internal_print_type): Declare "i" in loop header. * rs6000-tdep.c (ppc_process_record): Rename inner "addr". * riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner scope. * remote.c (remote_target::update_thread_list): Don't redeclare "tp". (remote_target::process_initial_stop_replies): Rename inner "thread". (remote_target::remote_parse_stop_reply): Don't redeclare "p". (remote_target::wait_as): Don't redeclare "stop_reply". (remote_target::get_thread_local_address): Rename inner "result". (remote_target::get_tib_address): Likewise.
2018-04-22 00:16:27 +02:00
if ((dp_op == 0 || dp_op == 0xa) && rn == 0xf)
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
err = thumb_copy_pc_relative_32bit (gdbarch, insn1, insn2,
regs, dsc);
else
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"dp/pb", dsc);
}
else /* Data processing (modified immediate) */
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"dp/mi", dsc);
}
break;
case 3: /* op1 = 3 */
switch (bits (insn1, 9, 10))
{
case 0:
if (bit (insn1, 4))
err = decode_thumb_32bit_ld_mem_hints (gdbarch, insn1, insn2,
regs, dsc);
else /* NEON Load/Store and Store single data item */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"neon elt/struct load/store",
dsc);
break;
case 1: /* op1 = 3, bits (9, 10) == 1 */
switch (bits (insn1, 7, 8))
{
case 0: case 1: /* Data processing (register) */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"dp(reg)", dsc);
break;
case 2: /* Multiply and absolute difference */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"mul/mua/diff", dsc);
break;
case 3: /* Long multiply and divide */
err = thumb_copy_unmodified_32bit (gdbarch, insn1, insn2,
"lmul/lmua", dsc);
break;
}
break;
default: /* Coprocessor instructions */
err = thumb2_decode_svc_copro (gdbarch, insn1, insn2, regs, dsc);
break;
}
break;
default:
err = 1;
}
if (err)
internal_error (__FILE__, __LINE__,
_("thumb_process_displaced_32bit_insn: Instruction decode error"));
}
static void
thumb_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
{
Support displaced stepping for Thumb 16-bit insns. gdb/ * arm-tdep.c (THUMB_NOP) Define. (thumb_copy_unmodified_16bit): New. (thumb_copy_b, thumb_copy_bx_blx_reg): New. (thumb_copy_alu_reg): New. (arm_copy_svc): Move some common code to ... (install_svc): ... here. New. (thumb_copy_svc): New. (install_pc_relative): New. (thumb_copy_pc_relative_16bit): New. (thumb_decode_pc_relative_16bit): New. (thumb_copy_16bit_ldr_literal): New. (thumb_copy_cbnz_cbz): New. (cleanup_pop_pc_16bit_all): New. (thumb_copy_pop_pc_16bit): New. (thumb_process_displaced_16bit_insn): New. (thumb_process_displaced_32bit_insn): New. (thumb_process_displaced_insn): process thumb instruction. Support displaced stepping for Thumb 32-bit insns. gdb/ * arm-tdep.c (thumb_copy_unmodified_32bit): New. (thumb2_copy_preload): New. (thumb2_copy_copro_load_store): New. (thumb2_copy_b_bl_blx): New. (thumb2_copy_alu_imm): New. (thumb2_copy_load_reg_imm): New. (thumb2_copy_load_literal): New (thumb2_copy_block_xfer): New. (thumb_32bit_copy_undef): New. (thumb_32bit_copy_unpred): New. (thumb2_decode_ext_reg_ld_st): New. (thumb2_decode_svc_copro): New. (decode_thumb_32bit_store_single_data_item): New. (thumb_copy_pc_relative_32bit): New. (thumb_decode_pc_relative_32bit): New. (decode_thumb_32bit_ld_mem_hints): New. (thumb2_copy_table_branch): New (thumb_process_displaced_32bit_insn): Process Thumb 32-bit instructions. gdb/testsuite/ * gdb.arch/arm-disp-step.S (test_ldr_literal): Test for Thumb instructions. (test_adr_32bit, test_pop_pc): Likewise. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New test for Thumb instructions. * gdb.arch/arm-disp-step.exp (test_ldm_stm_pc): Match $gdb_prompt in gdb_test_multiple. (test_ldr_literal_16, test_cbz_cbnz, test_adr): New.
2011-09-18 16:34:55 +02:00
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
uint16_t insn1
= read_memory_unsigned_integer (from, 2, byte_order_for_code);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: process thumb insn %.4x "
"at %.8lx\n", insn1, (unsigned long) from);
dsc->is_thumb = 1;
dsc->insn_size = thumb_insn_size (insn1);
if (thumb_insn_size (insn1) == 4)
{
uint16_t insn2
= read_memory_unsigned_integer (from + 2, 2, byte_order_for_code);
thumb_process_displaced_32bit_insn (gdbarch, insn1, insn2, regs, dsc);
}
else
thumb_process_displaced_16bit_insn (gdbarch, insn1, regs, dsc);
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
void
arm_process_displaced_insn (struct gdbarch *gdbarch, CORE_ADDR from,
CORE_ADDR to, struct regcache *regs,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
int err = 0;
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
uint32_t insn;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Most displaced instructions use a 1-instruction scratch space, so set this
here and override below if/when necessary. */
dsc->numinsns = 1;
dsc->insn_addr = from;
dsc->scratch_base = to;
dsc->cleanup = NULL;
dsc->wrote_to_pc = 0;
if (!displaced_in_arm_mode (regs))
return thumb_process_displaced_insn (gdbarch, from, regs, dsc);
dsc->is_thumb = 0;
dsc->insn_size = 4;
insn = read_memory_unsigned_integer (from, 4, byte_order_for_code);
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: stepping insn %.8lx "
"at %.8lx\n", (unsigned long) insn,
(unsigned long) from);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if ((insn & 0xf0000000) == 0xf0000000)
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
err = arm_decode_unconditional (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
else switch (((insn & 0x10) >> 4) | ((insn & 0xe000000) >> 24))
{
case 0x0: case 0x1: case 0x2: case 0x3:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
err = arm_decode_dp_misc (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
case 0x4: case 0x5: case 0x6:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
err = arm_decode_ld_st_word_ubyte (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
case 0x7:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
err = arm_decode_media (gdbarch, insn, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
case 0x8: case 0x9: case 0xa: case 0xb:
2011-04-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (copy_unmodified): Rename to ... (arm_copy_unmodified): .. this. New. (copy_preload): Move common part to ... (install_preload): .. this. New. (arm_copy_preload): New. (copy_preload_reg): Move common part to ... (install_preload_reg): ... this. New. (arm_copy_preload_reg): New. (copy_b_bl_blx): Move common part to ... (install_b_bl_blx): .. this. New. (arm_copy_b_bl_blx): New. (copy_bx_blx_reg): Move common part to ... (install_bx_blx_reg): ... this. New. (arm_copy_bx_blx_reg): New. (copy_alu_reg): Move common part to ... (install_alu_reg): ... this. New. (arm_copy_alu_reg): New. (copy_alu_shifted_reg): Move common part to ... (install_alu_shifted_reg): ... this. New. (copy_ldr_str_ldrb_strb): Move common part to ... (install_ldr_str_ldrb_strb): ... this. New. (arm_copy_ldr_str_ldrb_strb): New. (copy_copro_load_store): Move some common part to ... (install_copy_copro_load_store): ... this. New. (arm_copy_copro_load_store): New. (copy_svc): Delete. (arm_copy_svc): Renamed from copy_svc. (copy_undef): Delete. (arm_copy_undef): Renamed from copy_undef. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_svc_copro): Delete. (arm_decode_svc_copro): Renamed from decode_svc_copro. (copy_copro_load_store, copy_alu_imm): update callers. (copy_extra_ld_st, copy_block_xfer): Likewise. (decode_misc_memhint_neon, decode_unconditional): Likewise. (decode_miscellaneous, decode_dp_misc): Likewise. (decode_ld_st_word_ubyte, decode_media): Likewise. (decode_b_bl_ldmstm, decode_ext_reg_ld_st): Likewise. (decode_svc_copro, decode_misc_memhint_neon): Likewise. (decode_unconditional, decode_miscellaneous): Likewise. (decode_media, decode_b_bl_ldmstm): Likewise. (arm_process_displaced_insn): Likewise.. (decode_misc_memhint_neon): Delete. (arm_decode_misc_memhint_neon): Renamed from decode_misc_memhint_neon. (decode_miscellaneous): Delete. (arm_decode_miscellaneous): Renamed from decode_miscellaneous. (decode_dp_misc): Delete. (arm_decode_dp_misc): Renamed from decode_dp_misc. (decode_ld_st_word_ubyte): Delete. (arm_decode_ld_st_word_ubyte): Renamed from decode_ld_st_word_ubyte. (decode_media): Delete. (arm_decode_media): Renamed from decode_media. (decode_b_bl_ldmstm): Delete. (arm_decode_b_bl_ldmstm): Renamed from decode_b_bl_ldmstm. (decode_ext_reg_ld_st): Delete. (arm_decode_ext_reg_ld_st): Renamed from decode_ext_reg_ld_st. (decode_unconditional): Delete. (arm_decode_unconditional): Renamed from decode_unconditional.
2011-04-28 06:59:21 +02:00
err = arm_decode_b_bl_ldmstm (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
case 0xc: case 0xd: case 0xe: case 0xf:
err = arm_decode_svc_copro (gdbarch, insn, regs, dsc);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
}
if (err)
internal_error (__FILE__, __LINE__,
_("arm_process_displaced_insn: Instruction decode error"));
}
/* Actually set up the scratch space for a displaced instruction. */
void
arm_displaced_init_closure (struct gdbarch *gdbarch, CORE_ADDR from,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
CORE_ADDR to, arm_displaced_step_closure *dsc)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
unsigned int i, len, offset;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
int size = dsc->is_thumb? 2 : 4;
-Wpointer-sign: char -> gdb_byte. -Wpointer-sign catches all these cases across the codebase that should be using gdb_byte for raw target bytes. I think these are all obvious, hence I've collapsed into a single patch. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * aarch64-tdep.c (aarch64_default_breakpoint): Change type to gdb_byte[]. (aarch64_breakpoint_from_pc): Change return type to gdb_byte *. * ada-lang.c (ada_value_assign): Use gdb_byte. * alphanbsd-tdep.c (sigtramp_retcode): Change type to gdb_byte[]. (alphanbsd_sigtramp_offset): Use gdb_byte. * arm-linux-tdep.c (arm_linux_arm_le_breakpoint) (arm_linux_arm_be_breakpoint, eabi_linux_arm_le_breakpoint) (eabi_linux_arm_be_breakpoint, arm_linux_thumb_be_breakpoint) (arm_linux_thumb_le_breakpoint, arm_linux_thumb2_be_breakpoint) (arm_linux_thumb2_le_breakpoint): Change type to gdb_byte[]. * arm-tdep.c (arm_stub_unwind_sniffer) (arm_displaced_init_closure): Use gdb_byte. (arm_default_arm_le_breakpoint, arm_default_arm_be_breakpoint) (arm_default_thumb_le_breakpoint) (arm_default_thumb_be_breakpoint): Change type to gdb_byte[]. * arm-tdep.h (struct gdbarch_tdep) <arm_breakpoint, thumb_breakpoint, thumb2_breakpoint>: Change type to gdb_byte *. * arm-wince-tdep.c (arm_wince_le_breakpoint) (arm_wince_thumb_le_breakpoint): Change type to gdb_byte[]. * armnbsd-tdep.c (arm_nbsd_arm_le_breakpoint) (arm_nbsd_arm_be_breakpoint, arm_nbsd_thumb_le_breakpoint) (arm_nbsd_thumb_be_breakpoint): Change type to gdb_byte[]. * armobsd-tdep.c (arm_obsd_thumb_le_breakpoint) (arm_obsd_thumb_be_breakpoint): Change type to gdb_byte[]. * cris-tdep.c (push_stack_item, cris_push_dummy_call) (cris_store_return_value, cris_extract_return_value): Use gdb_byte. (constraint): Change type of parameter to char * from signed char*. Use gdb_byte. * dwarf2loc.c (read_pieced_value, write_pieced_value): Change type of local buffer to gdb_byte *. * dwarf2read.c (read_index_from_section): Use gdb_byte. (create_dwp_hash_table): Change type of locals to gdb_byte *. (add_address_entry): Change type of local buffer to gdb_byte[]. * frv-tdep.c (frv_adjust_breakpoint_address, find_func_descr) (frv_push_dummy_call): Use gdb_byte. * hppa-hpux-tdep.c (hppa_hpux_push_dummy_code) (hppa_hpux_supply_ss_fpblock, hppa_hpux_supply_ss_wide) (hppa_hpux_supply_save_state): Use gdb_byte. * hppa-tdep.c (hppa32_push_dummy_call) (hppa64_convert_code_addr_to_fptr): Use gdb_byte. * ia64-tdep.c (extract_bit_field, replace_bit_field) (slotN_contents, replace_slotN_contents): Change type of parameter to gdb_byte *. (fetch_instruction, ia64_pseudo_register_write) (ia64_register_to_value, ia64_value_to_register) (ia64_extract_return_value, ia64_store_return_value) (ia64_push_dummy_call): Use gdb_byte. * m32c-tdep.c (m32c_return_value): Remove cast. * m68hc11-tdep.c (m68hc11_pseudo_register_write) (m68hc11_push_dummy_call, m68hc11_store_return_value): Use gdb_byte. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use gdb_byte. * mn10300-tdep.c (mn10300_store_return_value) (mn10300_breakpoint_from_pc, mn10300_push_dummy_call): Use gdb_byte. * moxie-tdep.c (moxie_process_readu): Use gdb_byte. (moxie_process_record): Remove casts. * ppc-ravenscar-thread.c (supply_register_at_address) (ppc_ravenscar_generic_store_registers): Use gdb_byte. * ravenscar-thread.c (get_running_thread_id): Use gdb_byte. * remote-m32r-sdi.c (m32r_fetch_register): Use gdb_byte. * remote-mips.c (mips_xfer_memory): Use gdb_byte. * remote.c (compare_sections_command): Use gdb_byte. * score-tdep.c (score7_free_memblock): Change type of parameter to gdb_byte *. * sh-tdep.c (sh_justify_value_in_reg): Change return type to gdb_byte *. Use gdb_byte. (sh_push_dummy_call_fpu): Use gdb_byte. (sh_extract_return_value_nofpu, sh_extract_return_value_fpu) (sh_store_return_value_nofpu, sh_store_return_value_fpu) (sh_register_convert_to_virtual, sh_register_convert_to_raw): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh_pseudo_register_read, sh_pseudo_register_write): Use gdb_byte. * sh64-tdep.c (sh64_push_dummy_call): Use gdb_byte. (sh64_store_return_value, sh64_register_convert_to_virtual): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh64_pseudo_register_write): Use gdb_byte. * solib-darwin.c (darwin_current_sos): Add casts to 'gdb_byte *'. * solib-irix.c (fetch_lm_info): Likewise. Use gdb_byte for byte buffer. (irix_current_sos): Use gdb_byte. * solib-som.c (som_current_sos): Use gdb_byte. * sparc-ravenscar-thread.c (supply_register_at_address) (sparc_ravenscar_generic_store_registers): Use gdb_byte. * spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'. * spu-tdep.c (spu_get_overlay_table): Use gdb_byte. * tic6x-tdep.c (tic6x_breakpoint_from_pc): Change return type to 'gdb_byte *'. * tic6x-tdep.h (struct gdbarch_tdep) <breakpoint>: Change type to 'gdb_byte *'. * tracepoint.c (tfile_fetch_registers): Use gdb_byte. * xstormy16-tdep.c (xstormy16_extract_return_value) (xstormy16_store_return_value): Change parameter type to 'gdb_byte *'. Adjust. (xstormy16_push_dummy_call): Use gdb_byte. * xtensa-tdep.c (xtensa_scan_prologue, call0_ret) (call0_analyze_prologue, execute_code): Use gdb_byte.
2013-04-19 17:09:46 +02:00
const gdb_byte *bkp_insn;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
offset = 0;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Poke modified instruction(s). */
for (i = 0; i < dsc->numinsns; i++)
{
if (debug_displaced)
{
fprintf_unfiltered (gdb_stdlog, "displaced: writing insn ");
if (size == 4)
fprintf_unfiltered (gdb_stdlog, "%.8lx",
dsc->modinsn[i]);
else if (size == 2)
fprintf_unfiltered (gdb_stdlog, "%.4x",
(unsigned short)dsc->modinsn[i]);
fprintf_unfiltered (gdb_stdlog, " at %.8lx\n",
(unsigned long) to + offset);
}
write_memory_unsigned_integer (to + offset, size,
byte_order_for_code,
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
dsc->modinsn[i]);
offset += size;
}
/* Choose the correct breakpoint instruction. */
if (dsc->is_thumb)
{
bkp_insn = tdep->thumb_breakpoint;
len = tdep->thumb_breakpoint_size;
}
else
{
bkp_insn = tdep->arm_breakpoint;
len = tdep->arm_breakpoint_size;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* Put breakpoint afterwards. */
write_memory (to + offset, bkp_insn, len);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (debug_displaced)
fprintf_unfiltered (gdb_stdlog, "displaced: copy %s->%s: ",
paddress (gdbarch, from), paddress (gdbarch, to));
}
/* Entry point for cleaning things up after a displaced instruction has been
single-stepped. */
void
arm_displaced_step_fixup (struct gdbarch *gdbarch,
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
struct displaced_step_closure *dsc_,
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs)
{
Create a displaced_step_closure class hierarchy displaced_step_closure is a type defined in multiple -tdep.c files. Trying to xfree it from the common code (infrun.c) is a problem when we try to poison xfree for non-POD types. Because there can be multiple of these types in the same build, this patch makes a hierarchy of classes with a virtual destructor. When the common code deletes the object through a displaced_step_closure pointer, it will invoke the right destructor. The amd64 used a last-member array with a variable size. That doesn't work with new, so I changed it for an std::vector. Other architectures which used a simple byte buffer as a closure now use a shared buf_displaced_step_closure, a closure type that only contains a gdb::byte_vector. Reg-tested on the buildbot. gdb/ChangeLog: * infrun.h: Include common/byte-vector.h. (struct displaced_step_closure): New struct. (struct buf_displaced_step_closure): New struct. * infrun.c (displaced_step_closure::~displaced_step_closure): Provide default implementation. (displaced_step_clear): Deallocate step closure with delete. * aarch64-tdep.c (displaced_step_closure): Rename to ... (aarch64_displaced_step_closure): ... this, extend displaced_step_closure. (aarch64_displaced_step_data) <dsc>: Change type to aarch64_displaced_step_closure. (aarch64_displaced_step_copy_insn): Adjust to type change, use unique_ptr. (aarch64_displaced_step_fixup): Add cast for displaced step closure. * amd64-tdep.c (displaced_step_closure): Rename to ... (amd64_displaced_step_closure): ... this, extend displaced_step_closure. <insn_buf>: Change type to std::vector<gdb_byte>. <max_len>: Remove. (fixup_riprel): Change type of DSC parameter, adjust to type change of insn_buf. (fixup_displaced_copy): Change type of DSC parameter. (amd64_displaced_step_copy_insn): Instantiate amd64_displaced_step_closure. (amd64_displaced_step_fixup): Add cast for closure type, adjust to type change of insn_buf. * arm-linux-tdep.c (arm_linux_cleanup_svc): Change type of parameter DSC. (arm_linux_copy_svc): Likewise. (cleanup_kernel_helper_return): Likewise. (arm_catch_kernel_helper_return): Likewise. (arm_linux_displaced_step_copy_insn): Instantiate arm_displaced_step_closure. * arm-tdep.c (arm_pc_is_thumb): Add cast for closure. (displaced_read_reg): Change type of parameter DSC. (branch_write_pc): Likewise. (load_write_pc): Likewise. (alu_write_pc): Likewise. (displaced_write_reg): Likewise. (arm_copy_unmodified): Likewise. (thumb_copy_unmodified_32bit): Likewise. (thumb_copy_unmodified_16bit): Likewise. (cleanup_preload): Likewise. (install_preload): Likewise. (arm_copy_preload): Likewise. (thumb2_copy_preload): Likewise. (install_preload_reg): Likewise. (arm_copy_preload_reg): Likewise. (cleanup_copro_load_store): Likewise. (install_copro_load_store): Likewise. (arm_copy_copro_load_store) Likewise. (thumb2_copy_copro_load_store): Likewise. (cleanup_branch): Likewise. (install_b_bl_blx): Likewise. (arm_copy_b_bl_blx): Likewise. (thumb2_copy_b_bl_blx): Likewise. (thumb_copy_b): Likewise. (install_bx_blx_reg): Likewise. (arm_copy_bx_blx_reg): Likewise. (thumb_copy_bx_blx_reg): Likewise. (cleanup_alu_imm): Likewise. (arm_copy_alu_imm): Likewise. (thumb2_copy_alu_imm): Likewise. (cleanup_alu_reg): Likewise. (install_alu_reg): Likewise. (arm_copy_alu_reg): Likewise. (thumb_copy_alu_reg): Likewise. (cleanup_alu_shifted_reg): Likewise. (install_alu_shifted_reg): Likewise. (arm_copy_alu_shifted_reg): Likewise. (cleanup_load): Likewise. (cleanup_store): Likewise. (arm_copy_extra_ld_st): Likewise. (install_load_store): Likewise. (thumb2_copy_load_literal): Likewise. (thumb2_copy_load_reg_imm): Likewise. (arm_copy_ldr_str_ldrb_strb): Likewise. (cleanup_block_load_all): Likewise. (cleanup_block_store_pc): Likewise. (cleanup_block_load_pc): Likewise. (arm_copy_block_xfer): Likewise. (thumb2_copy_block_xfer): Likewise. (cleanup_svc): Likewise. (install_svc): Likewise. (arm_copy_svc): Likewise. (thumb_copy_svc): Likewise. (arm_copy_undef): Likewise. (thumb_32bit_copy_undef): Likewise. (arm_copy_unpred): Likewise. (arm_decode_misc_memhint_neon): Likewise. (arm_decode_unconditional): Likewise. (arm_decode_miscellaneous): Likewise. (arm_decode_dp_misc): Likewise. (arm_decode_ld_st_word_ubyte): Likewise. (arm_decode_media): Likewise. (arm_decode_b_bl_ldmstm): Likewise. (arm_decode_ext_reg_ld_st): Likewise. (thumb2_decode_dp_shift_reg): Likewise. (thumb2_decode_ext_reg_ld_st): Likewise. (arm_decode_svc_copro): Likewise. (thumb2_decode_svc_copro): Likewise. (install_pc_relative): Likewise. (thumb_copy_pc_relative_16bit): Likewise. (thumb_decode_pc_relative_16bit): Likewise. (thumb_copy_pc_relative_32bit): Likewise. (thumb_copy_16bit_ldr_literal): Likewise. (thumb_copy_cbnz_cbz): Likewise. (thumb2_copy_table_branch): Likewise. (cleanup_pop_pc_16bit_all): Likewise. (thumb_copy_pop_pc_16bit): Likewise. (thumb_process_displaced_16bit_insn): Likewise. (decode_thumb_32bit_ld_mem_hints): Likewise. (thumb_process_displaced_32bit_insn): Likewise. (thumb_process_displaced_insn): Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (arm_displaced_step_fixup): Add cast for closure. * arm-tdep.h: Include infrun.h. (displaced_step_closure): Rename to ... (arm_displaced_step_closure): ... this, extend displaced_step_closure. <u::svc::copy_svc_os>: Change type of parameter DSC. <cleanup>: Likewise. (arm_process_displaced_insn): Likewise. (arm_displaced_init_closure): Likewise. (displaced_read_reg): Likewise. (displaced_write_reg): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Adjust. * i386-tdep.h: Include infrun.h. (i386_displaced_step_closure): New typedef. * i386-tdep.c (i386_displaced_step_copy_insn): Use i386_displaced_step_closure. (i386_displaced_step_fixup): Adjust. * rs6000-tdep.c (ppc_displaced_step_closure): New typedef. (ppc_displaced_step_copy_insn): Use ppc_displaced_step_closure and unique_ptr. (ppc_displaced_step_fixup): Adjust. * s390-linux-tdep.c (s390_displaced_step_closure): New typedef. (s390_displaced_step_copy_insn): Use s390_displaced_step_closure and unique_ptr. (s390_displaced_step_fixup): Adjust.
2017-10-21 17:27:52 +02:00
arm_displaced_step_closure *dsc = (arm_displaced_step_closure *) dsc_;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (dsc->cleanup)
dsc->cleanup (gdbarch, regs, dsc);
if (!dsc->wrote_to_pc)
regcache_cooked_write_unsigned (regs, ARM_PC_REGNUM,
dsc->insn_addr + dsc->insn_size);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
#include "bfd-in2.h"
#include "libcoff.h"
static int
gdb_print_insn_arm (bfd_vma memaddr, disassemble_info *info)
{
Refactor disassembly code This patch addes class gdb_disassembler, and refactor code to use it. The gdb_disassembler object is saved in disassember_info.application_data. However, disassember_info.application_data is already used by gdb for arm, mips spu, and scm-disasm. In arm and mips, .application_data is gdbarch, but we can still get gdbarch from gdb_disassember. The use of application_data in spu is a little bit complicated. It creates its own disassemble_info, and save spu_dis_asm_data in .application_data. This will overwrite the pointer to gdb_disassembler, so we need to find another place to save spu_dis_asm_data. I extend disassemble_info, and put "id" there. gdb: 2017-01-26 Pedro Alves <palves@redhat.com> Yao Qi <yao.qi@linaro.org> * arm-tdep.c: Include "disasm.h". (gdb_print_insn_arm): Update code to get gdbarch. * disasm.c (dis_asm_read_memory): Change it to gdb_disassembler::dis_asm_read_memory. (dis_asm_memory_error): Likewise. (dis_asm_print_address): Likewise. (gdb_pretty_print_insn): Change it to gdb_disassembler::pretty_print_insn. (dump_insns): Add one argument gdb_disassemlber. All callers updated. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. (do_assembly_only): Likewise. (gdb_disassembler::gdb_disassembler): New. (gdb_disassembler::print_insn): New. * disasm.h (class gdb_disassembler): New. (gdb_pretty_print_insn): Remove declaration. (gdb_disassemble_info): Likewise. * guile/scm-disasm.c (class gdbscm_disassembler): New. (gdbscm_disasm_read_memory_worker): Update. (gdbscm_disasm_read_memory): Update. (gdbscm_disasm_memory_error): Remove. (gdbscm_disasm_print_address): Remove. (gdbscm_disassembler::gdbscm_disassembler): New. (gdbscm_print_insn_from_port): Update. * mips-tdep.c: Include disasm.h. (gdb_print_insn_mips): Update code to get gdbarch. * record-btrace.c (btrace_insn_history): Update. * spu-tdep.c: Include disasm.h. (struct spu_dis_asm_data): Remove. (struct spu_dis_asm_info): New. (spu_dis_asm_print_address): Use spu_dis_asm_info to get SPU id. (gdb_print_insn_spu): Cast disassemble_info to spu_dis_asm_info.
2017-01-26 15:29:19 +01:00
gdb_disassembler *di
= static_cast<gdb_disassembler *>(info->application_data);
struct gdbarch *gdbarch = di->arch ();
if (arm_pc_is_thumb (gdbarch, memaddr))
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
static asymbol *asym;
static combined_entry_type ce;
static struct coff_symbol_struct csym;
static struct bfd fake_bfd;
static bfd_target fake_target;
if (csym.native == NULL)
{
/* Create a fake symbol vector containing a Thumb symbol.
This is solely so that the code in print_insn_little_arm()
and print_insn_big_arm() in opcodes/arm-dis.c will detect
the presence of a Thumb symbol and switch to decoding
Thumb instructions. */
fake_target.flavour = bfd_target_coff_flavour;
fake_bfd.xvec = &fake_target;
ce.u.syment.n_sclass = C_THUMBEXTFUNC;
csym.native = &ce;
csym.symbol.the_bfd = &fake_bfd;
csym.symbol.name = "fake";
asym = (asymbol *) & csym;
}
memaddr = UNMAKE_THUMB_ADDR (memaddr);
info->symbols = &asym;
}
else
info->symbols = NULL;
/* GDB is able to get bfd_mach from the exe_bfd, info->mach is
accurate, so mark USER_SPECIFIED_MACHINE_TYPE bit. Otherwise,
opcodes/arm-dis.c:print_insn reset info->mach, and it will trigger
the assert on the mismatch of info->mach and bfd_get_mach (exec_bfd)
in default_print_insn. */
if (exec_bfd != NULL)
info->flags |= USER_SPECIFIED_MACHINE_TYPE;
Don't use print_insn_XXX in GDB This is a follow-up to [PATCH 0/6] Unify the disassembler selection in gdb and objdump https://sourceware.org/ml/binutils/2017-05/msg00192.html that is, opcodes is able to select the right disassembler, so gdb doesn't have to select them. Instead, gdb can just use default_print_insn. As a result, these print_insn_XXX are not used out of opcodes, so this patch also moves their declarations from include/dis-asm.h to opcodes/disassemble.h. With this change, GDB doesn't use any print_insn_XXX directly any more. gdb: 2017-06-14 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_gdb_print_insn): Call default_print_insn instead of print_insn_aarch64. * arm-tdep.c (gdb_print_insn_arm): Call default_print_insn instead of print_insn_big_arm and print_insn_little_arm. * i386-tdep.c (i386_print_insn): Call default_print_insn instead of print_insn_i386. * ia64-tdep.c (ia64_print_insn): Call default_print_insn instead of print_insn_ia64. * mips-tdep.c (gdb_print_insn_mips): Call default_print_insn instead of print_insn_big_mips and print_insn_little_mips. * spu-tdep.c (gdb_print_insn_spu): Call default_print_insn instead of print_insn_spu. include: 2017-06-14 Yao Qi <yao.qi@linaro.org> * dis-asm.h (print_insn_aarch64): Move it to opcodes/disassemble.h. (print_insn_big_arm, print_insn_big_mips): Likewise. (print_insn_i386, print_insn_ia64): Likewise. (print_insn_little_arm, print_insn_little_mips): Likewise. (print_insn_spu): Likewise. opcodes: 2017-06-14 Yao Qi <yao.qi@linaro.org> * aarch64-dis.c: Include disassemble.h instead of dis-asm.h. * arm-dis.c: Likewise. * ia64-dis.c: Likewise. * mips-dis.c: Likewise. * spu-dis.c: Likewise. * disassemble.h (print_insn_aarch64): New declaration, moved from include/dis-asm.h. (print_insn_big_arm, print_insn_big_mips): Likewise. (print_insn_i386, print_insn_ia64): Likewise. (print_insn_little_arm, print_insn_little_mips): Likewise.
2017-06-14 17:28:30 +02:00
return default_print_insn (memaddr, info);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
/* The following define instruction sequences that will cause ARM
cpu's to take an undefined instruction trap. These are used to
signal a breakpoint to GDB.
The newer ARMv4T cpu's are capable of operating in ARM or Thumb
modes. A different instruction is required for each mode. The ARM
cpu's can also be big or little endian. Thus four different
instructions are needed to support all cases.
Note: ARMv4 defines several new instructions that will take the
undefined instruction trap. ARM7TDMI is nominally ARMv4T, but does
not in fact add the new instructions. The new undefined
instructions in ARMv4 are all instructions that had no defined
behaviour in earlier chips. There is no guarantee that they will
raise an exception, but may be treated as NOP's. In practice, it
may only safe to rely on instructions matching:
3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
C C C C 0 1 1 x x x x x x x x x x x x x x x x x x x x 1 x x x x
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
Even this may only true if the condition predicate is true. The
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
following use a condition predicate of ALWAYS so it is always TRUE.
There are other ways of forcing a breakpoint. GNU/Linux, RISC iX,
and NetBSD all use a software interrupt rather than an undefined
instruction to force a trap. This can be handled by by the
abi-specific code during establishment of the gdbarch vector. */
#define ARM_LE_BREAKPOINT {0xFE,0xDE,0xFF,0xE7}
#define ARM_BE_BREAKPOINT {0xE7,0xFF,0xDE,0xFE}
#define THUMB_LE_BREAKPOINT {0xbe,0xbe}
#define THUMB_BE_BREAKPOINT {0xbe,0xbe}
-Wpointer-sign: char -> gdb_byte. -Wpointer-sign catches all these cases across the codebase that should be using gdb_byte for raw target bytes. I think these are all obvious, hence I've collapsed into a single patch. gdb/ 2013-04-19 Pedro Alves <palves@redhat.com> * aarch64-tdep.c (aarch64_default_breakpoint): Change type to gdb_byte[]. (aarch64_breakpoint_from_pc): Change return type to gdb_byte *. * ada-lang.c (ada_value_assign): Use gdb_byte. * alphanbsd-tdep.c (sigtramp_retcode): Change type to gdb_byte[]. (alphanbsd_sigtramp_offset): Use gdb_byte. * arm-linux-tdep.c (arm_linux_arm_le_breakpoint) (arm_linux_arm_be_breakpoint, eabi_linux_arm_le_breakpoint) (eabi_linux_arm_be_breakpoint, arm_linux_thumb_be_breakpoint) (arm_linux_thumb_le_breakpoint, arm_linux_thumb2_be_breakpoint) (arm_linux_thumb2_le_breakpoint): Change type to gdb_byte[]. * arm-tdep.c (arm_stub_unwind_sniffer) (arm_displaced_init_closure): Use gdb_byte. (arm_default_arm_le_breakpoint, arm_default_arm_be_breakpoint) (arm_default_thumb_le_breakpoint) (arm_default_thumb_be_breakpoint): Change type to gdb_byte[]. * arm-tdep.h (struct gdbarch_tdep) <arm_breakpoint, thumb_breakpoint, thumb2_breakpoint>: Change type to gdb_byte *. * arm-wince-tdep.c (arm_wince_le_breakpoint) (arm_wince_thumb_le_breakpoint): Change type to gdb_byte[]. * armnbsd-tdep.c (arm_nbsd_arm_le_breakpoint) (arm_nbsd_arm_be_breakpoint, arm_nbsd_thumb_le_breakpoint) (arm_nbsd_thumb_be_breakpoint): Change type to gdb_byte[]. * armobsd-tdep.c (arm_obsd_thumb_le_breakpoint) (arm_obsd_thumb_be_breakpoint): Change type to gdb_byte[]. * cris-tdep.c (push_stack_item, cris_push_dummy_call) (cris_store_return_value, cris_extract_return_value): Use gdb_byte. (constraint): Change type of parameter to char * from signed char*. Use gdb_byte. * dwarf2loc.c (read_pieced_value, write_pieced_value): Change type of local buffer to gdb_byte *. * dwarf2read.c (read_index_from_section): Use gdb_byte. (create_dwp_hash_table): Change type of locals to gdb_byte *. (add_address_entry): Change type of local buffer to gdb_byte[]. * frv-tdep.c (frv_adjust_breakpoint_address, find_func_descr) (frv_push_dummy_call): Use gdb_byte. * hppa-hpux-tdep.c (hppa_hpux_push_dummy_code) (hppa_hpux_supply_ss_fpblock, hppa_hpux_supply_ss_wide) (hppa_hpux_supply_save_state): Use gdb_byte. * hppa-tdep.c (hppa32_push_dummy_call) (hppa64_convert_code_addr_to_fptr): Use gdb_byte. * ia64-tdep.c (extract_bit_field, replace_bit_field) (slotN_contents, replace_slotN_contents): Change type of parameter to gdb_byte *. (fetch_instruction, ia64_pseudo_register_write) (ia64_register_to_value, ia64_value_to_register) (ia64_extract_return_value, ia64_store_return_value) (ia64_push_dummy_call): Use gdb_byte. * m32c-tdep.c (m32c_return_value): Remove cast. * m68hc11-tdep.c (m68hc11_pseudo_register_write) (m68hc11_push_dummy_call, m68hc11_store_return_value): Use gdb_byte. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Use gdb_byte. * mn10300-tdep.c (mn10300_store_return_value) (mn10300_breakpoint_from_pc, mn10300_push_dummy_call): Use gdb_byte. * moxie-tdep.c (moxie_process_readu): Use gdb_byte. (moxie_process_record): Remove casts. * ppc-ravenscar-thread.c (supply_register_at_address) (ppc_ravenscar_generic_store_registers): Use gdb_byte. * ravenscar-thread.c (get_running_thread_id): Use gdb_byte. * remote-m32r-sdi.c (m32r_fetch_register): Use gdb_byte. * remote-mips.c (mips_xfer_memory): Use gdb_byte. * remote.c (compare_sections_command): Use gdb_byte. * score-tdep.c (score7_free_memblock): Change type of parameter to gdb_byte *. * sh-tdep.c (sh_justify_value_in_reg): Change return type to gdb_byte *. Use gdb_byte. (sh_push_dummy_call_fpu): Use gdb_byte. (sh_extract_return_value_nofpu, sh_extract_return_value_fpu) (sh_store_return_value_nofpu, sh_store_return_value_fpu) (sh_register_convert_to_virtual, sh_register_convert_to_raw): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh_pseudo_register_read, sh_pseudo_register_write): Use gdb_byte. * sh64-tdep.c (sh64_push_dummy_call): Use gdb_byte. (sh64_store_return_value, sh64_register_convert_to_virtual): Change parameter type to 'gdb_byte *'. Use gdb_byte. (sh64_pseudo_register_write): Use gdb_byte. * solib-darwin.c (darwin_current_sos): Add casts to 'gdb_byte *'. * solib-irix.c (fetch_lm_info): Likewise. Use gdb_byte for byte buffer. (irix_current_sos): Use gdb_byte. * solib-som.c (som_current_sos): Use gdb_byte. * sparc-ravenscar-thread.c (supply_register_at_address) (sparc_ravenscar_generic_store_registers): Use gdb_byte. * spu-multiarch.c (spu_xfer_partial): Add cast to 'char *'. * spu-tdep.c (spu_get_overlay_table): Use gdb_byte. * tic6x-tdep.c (tic6x_breakpoint_from_pc): Change return type to 'gdb_byte *'. * tic6x-tdep.h (struct gdbarch_tdep) <breakpoint>: Change type to 'gdb_byte *'. * tracepoint.c (tfile_fetch_registers): Use gdb_byte. * xstormy16-tdep.c (xstormy16_extract_return_value) (xstormy16_store_return_value): Change parameter type to 'gdb_byte *'. Adjust. (xstormy16_push_dummy_call): Use gdb_byte. * xtensa-tdep.c (xtensa_scan_prologue, call0_ret) (call0_analyze_prologue, execute_code): Use gdb_byte.
2013-04-19 17:09:46 +02:00
static const gdb_byte arm_default_arm_le_breakpoint[] = ARM_LE_BREAKPOINT;
static const gdb_byte arm_default_arm_be_breakpoint[] = ARM_BE_BREAKPOINT;
static const gdb_byte arm_default_thumb_le_breakpoint[] = THUMB_LE_BREAKPOINT;
static const gdb_byte arm_default_thumb_be_breakpoint[] = THUMB_BE_BREAKPOINT;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind This patch adds two gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind, and uses target_info.placed_size as "kind" of the breakpoint. This patch updates the usages of target_info.placed_size. The "kind" of a breakpoint is determined by gdbarch rather than target, so we have gdbarch method breakpoint_kind_from_pc, and we should set target_info.placed_size out of each implementation of target to_insert_breakpoint. In this way, each target doesn't have to set target_info.placed_size any more. This patch also sets target_info.placed_address before target_insert_breakpoint too, so that target to_insert_breakpoint can use it, see record_full_insert_breakpoint. Before we call target_insert_breakpoint, we set target_info.placed_address and target_info.placed_size like this, CORE_ADDR addr = bl->target_info.reqstd_address; bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr); bl->target_info.placed_address = addr; return target_insert_breakpoint (bl->gdbarch, &bl->target_info); target_insert_breakpoint may fail, but it doesn't matter to the "kind" and "placed_address" of a breakpoint. They should be determined by gdbarch. gdb: 2016-11-03 Yao Qi <yao.qi@linaro.org> * arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define breakpoint_kind_from_pc and sw_breakpoint_from_kind. (GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise. (SET_GDBARCH_BREAKPOINT_MANIPULATION): Call set_gdbarch_breakpoint_kind_from_pc and set_gdbarch_sw_breakpoint_from_kind. * arm-tdep.c: Add comments. * bfin-tdep.c: Likewise. * breakpoint.c (breakpoint_kind): New function. (insert_bp_location): Set target_info.placed_size and target_info.placed_address. (bkpt_insert_location): Likewise. * cris-tdep.c: Add comments. * gdbarch.sh (breakpoint_kind_from_pc): New. (sw_breakpoint_from_kind): New. * gdbarch.c, gdbarch.h: Regenerated. * ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set bp_tgt->placed_size. (ia64_memory_remove_breakpoint): Don't assert bp_tgt->placed_size. (ia64_breakpoint_kind_from_pc): New function. (ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc. * m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set bp_tgt->placed_size. * mem-break.c (default_memory_insert_breakpoint): Don't set bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind. (default_memory_remove_breakpoint): Call gdbarch_sw_breakpoint_from_kind. (memory_validate_breakpoint): Don't check bp_tgt->placed_size. * mips-tdep.c: Add comments. * mt-tdep.c: Likewise. * nios2-tdep.c: Likewise. * record-full.c (record_full_insert_breakpoint): Don't call gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address and bp_tgt->placed_size. * remote.c (remote_insert_breakpoint): Don't call gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size. Don't set bp_tgt->placed_address and bp_tgt->placed_size. (remote_insert_hw_breakpoint): Likewise. * score-tdep.c: Likewise. * sh-tdep.c: Likewise. * tic6x-tdep.c: Likewise. * v850-tdep.c: Likewise. * xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
/* Implement the breakpoint_kind_from_pc gdbarch method. */
static int
arm_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (arm_pc_is_thumb (gdbarch, *pcptr))
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
*pcptr = UNMAKE_THUMB_ADDR (*pcptr);
/* If we have a separate 32-bit breakpoint instruction for Thumb-2,
check whether we are replacing a 32-bit instruction. */
if (tdep->thumb2_breakpoint != NULL)
{
gdb_byte buf[2];
if (target_read_memory (*pcptr, buf, 2) == 0)
{
unsigned short inst1;
inst1 = extract_unsigned_integer (buf, 2, byte_order_for_code);
if (thumb_insn_size (inst1) == 4)
return ARM_BP_KIND_THUMB2;
}
}
return ARM_BP_KIND_THUMB;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
else
return ARM_BP_KIND_ARM;
}
New gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind This patch adds two gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind, and uses target_info.placed_size as "kind" of the breakpoint. This patch updates the usages of target_info.placed_size. The "kind" of a breakpoint is determined by gdbarch rather than target, so we have gdbarch method breakpoint_kind_from_pc, and we should set target_info.placed_size out of each implementation of target to_insert_breakpoint. In this way, each target doesn't have to set target_info.placed_size any more. This patch also sets target_info.placed_address before target_insert_breakpoint too, so that target to_insert_breakpoint can use it, see record_full_insert_breakpoint. Before we call target_insert_breakpoint, we set target_info.placed_address and target_info.placed_size like this, CORE_ADDR addr = bl->target_info.reqstd_address; bl->target_info.placed_size = gdbarch_breakpoint_kind_from_pc (bl->gdbarch, &addr); bl->target_info.placed_address = addr; return target_insert_breakpoint (bl->gdbarch, &bl->target_info); target_insert_breakpoint may fail, but it doesn't matter to the "kind" and "placed_address" of a breakpoint. They should be determined by gdbarch. gdb: 2016-11-03 Yao Qi <yao.qi@linaro.org> * arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Define breakpoint_kind_from_pc and sw_breakpoint_from_kind. (GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN): Likewise. (SET_GDBARCH_BREAKPOINT_MANIPULATION): Call set_gdbarch_breakpoint_kind_from_pc and set_gdbarch_sw_breakpoint_from_kind. * arm-tdep.c: Add comments. * bfin-tdep.c: Likewise. * breakpoint.c (breakpoint_kind): New function. (insert_bp_location): Set target_info.placed_size and target_info.placed_address. (bkpt_insert_location): Likewise. * cris-tdep.c: Add comments. * gdbarch.sh (breakpoint_kind_from_pc): New. (sw_breakpoint_from_kind): New. * gdbarch.c, gdbarch.h: Regenerated. * ia64-tdep.c (ia64_memory_insert_breakpoint): Don't set bp_tgt->placed_size. (ia64_memory_remove_breakpoint): Don't assert bp_tgt->placed_size. (ia64_breakpoint_kind_from_pc): New function. (ia64_gdbarch_init): Install ia64_breakpoint_kind_from_pc. * m32r-tdep.c (m32r_memory_insert_breakpoint): Don't set bp_tgt->placed_size. * mem-break.c (default_memory_insert_breakpoint): Don't set bp_tgt->placed_size. Call gdbarch_sw_breakpoint_from_kind. (default_memory_remove_breakpoint): Call gdbarch_sw_breakpoint_from_kind. (memory_validate_breakpoint): Don't check bp_tgt->placed_size. * mips-tdep.c: Add comments. * mt-tdep.c: Likewise. * nios2-tdep.c: Likewise. * record-full.c (record_full_insert_breakpoint): Don't call gdbarch_breakpoint_from_pc. Don't set bp_tgt->placed_address and bp_tgt->placed_size. * remote.c (remote_insert_breakpoint): Don't call gdbarch_remote_breakpoint_from_pc. Use bp_tgt->placed_size. Don't set bp_tgt->placed_address and bp_tgt->placed_size. (remote_insert_hw_breakpoint): Likewise. * score-tdep.c: Likewise. * sh-tdep.c: Likewise. * tic6x-tdep.c: Likewise. * v850-tdep.c: Likewise. * xtensa-tdep.c: Likewise.
2016-11-03 15:35:13 +01:00
/* Implement the sw_breakpoint_from_kind gdbarch method. */
static const gdb_byte *
arm_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
switch (kind)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
case ARM_BP_KIND_ARM:
*size = tdep->arm_breakpoint_size;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return tdep->arm_breakpoint;
case ARM_BP_KIND_THUMB:
*size = tdep->thumb_breakpoint_size;
return tdep->thumb_breakpoint;
case ARM_BP_KIND_THUMB2:
*size = tdep->thumb2_breakpoint_size;
return tdep->thumb2_breakpoint;
default:
gdb_assert_not_reached ("unexpected arm breakpoint kind");
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
}
/* Implement the breakpoint_kind_from_current_state gdbarch method. */
static int
arm_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
struct regcache *regcache,
CORE_ADDR *pcptr)
{
gdb_byte buf[4];
/* Check the memory pointed by PC is readable. */
if (target_read_memory (regcache_read_pc (regcache), buf, 4) == 0)
{
struct arm_get_next_pcs next_pcs_ctx;
arm_get_next_pcs_ctor (&next_pcs_ctx,
&arm_get_next_pcs_ops,
gdbarch_byte_order (gdbarch),
gdbarch_byte_order_for_code (gdbarch),
0,
regcache);
Change return type of gdbarch_software_single_step to vector<CORE_ADDR> This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-05-02 19:30:07 +02:00
std::vector<CORE_ADDR> next_pcs = arm_get_next_pcs (&next_pcs_ctx);
/* If MEMADDR is the next instruction of current pc, do the
software single step computation, and get the thumb mode by
the destination address. */
Change return type of gdbarch_software_single_step to vector<CORE_ADDR> This is a relatively straightforward patch that changes gdbarch_software_single_step so it returns an std::vector<CORE_ADDR> instead of a VEC (CORE_ADDR). gdb/ChangeLog: * gdbarch.sh (software_single_step): Change return type to std::vector<CORE_ADDR>. * gdbarch.c, gdbarch.h: Re-generate. * arch/arm-get-next-pcs.c (thumb_deal_with_atomic_sequence_raw): Adjust. (arm_deal_with_atomic_sequence_raw): Adjust. (thumb_get_next_pcs_raw): Adjust. (arm_get_next_pcs_raw): Adjust. (arm_get_next_pcs): Adjust. * arch/arm-get-next-pcs.h (arm_get_next_pcs): Adjust. * aarch64-tdep.c (aarch64_software_single_step): Adjust. * alpha-tdep.c (alpha_deal_with_atomic_sequence): Adjust. (alpha_software_single_step): Adjust. * alpha-tdep.h (alpha_software_single_step): Adjust. * arm-linux-tdep.c (arm_linux_software_single_step): Adjust. * arm-tdep.c (arm_software_single_step): Adjust. (arm_breakpoint_kind_from_current_state): Adjust. * arm-tdep.h (arm_software_single_step): Adjust. * breakpoint.c (insert_single_step_breakpoint): Adjust. * cris-tdep.c (cris_software_single_step): Adjust. * mips-tdep.c (mips_deal_with_atomic_sequence): Adjust. (micromips_deal_with_atomic_sequence): Adjust. (deal_with_atomic_sequence): Adjust. (mips_software_single_step): Adjust. * mips-tdep.h (mips_software_single_step): Adjust. * moxie-tdep.c (moxie_software_single_step): Adjust. * nios2-tdep.c (nios2_software_single_step): Adjust. * ppc-tdep.h (ppc_deal_with_atomic_sequence): Adjust. * rs6000-aix-tdep.c (rs6000_software_single_step): Adjust. * rs6000-tdep.c (ppc_deal_with_atomic_sequence): Adjust. * s390-linux-tdep.c (s390_software_single_step): Adjust. * sparc-tdep.c (sparc_software_single_step): Adjust. * spu-tdep.c (spu_software_single_step): Adjust. * tic6x-tdep.c (tic6x_software_single_step): Adjust. gdb/gdbserver/ChangeLog: * linux-arm-low.c (arm_gdbserver_get_next_pcs): Adjust to software_single_step change of return type to std::vector<CORE_ADDR>. * linux-low.c (install_software_single_step_breakpoints): Likewise. * linux-low.h (install_software_single_step_breakpoints): Likewise.
2017-05-02 19:30:07 +02:00
for (CORE_ADDR pc : next_pcs)
{
if (UNMAKE_THUMB_ADDR (pc) == *pcptr)
{
if (IS_THUMB_ADDR (pc))
{
*pcptr = MAKE_THUMB_ADDR (*pcptr);
return arm_breakpoint_kind_from_pc (gdbarch, pcptr);
}
else
return ARM_BP_KIND_ARM;
}
}
}
return arm_breakpoint_kind_from_pc (gdbarch, pcptr);
}
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Extract from an array REGBUF containing the (raw) register state a
function return value of type TYPE, and copy that, in virtual
format, into VALBUF. */
static void
arm_extract_return_value (struct type *type, struct regcache *regs,
gdb_byte *valbuf)
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
struct gdbarch *gdbarch = regs->arch ();
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
if (TYPE_CODE_FLT == type->code ())
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
switch (gdbarch_tdep (gdbarch)->fp_model)
{
case ARM_FLOAT_FPA:
{
/* The value is in register F0 in internal format. We need to
extract the raw value and then convert it to the desired
internal type. */
bfd_byte tmpbuf[ARM_FP_REGISTER_SIZE];
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
regs->cooked_read (ARM_F0_REGNUM, tmpbuf);
Target FP: Remove convert_typed_floating from tdep files This patch mechanically replaces convert_typed_floating with the equivalent target_float_convert throughout tdep files, to prepare for the removal of doublest.{c,h}. No functional change intended. gdb/ChangeLog: 2017-11-06 Ulrich Weigand <uweigand@de.ibm.com> * i386-tdep.c: Include "target-float.h". Do not include "doublest.h". (i386_extract_return_value): Use target_float_convert. (i386_store_return_value): Likewise. * i387-tdep.c (i387_register_to_value): Use target_float_convert. (i387_value_to_register): Likewise. * ia64-tdep.c: Include "target-float.h". Do not include "doublest.h". (ia64_register_to_value): Use target_float_convert. (ia64_value_to_register): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (ia64_push_dummy_call): Likewise. * m68k-tdep.c: Include "target-float.h". (m68k_register_to_value): Use target_float_convert. (m68k_value_to_register): Likewise. (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * ppc-sysv-tdep.c: Include "target-float.h". (ppc_sysv_abi_push_dummy_call): Use target_float_convert. (do_ppc_sysv_return_value): Likewise. (ppc64_sysv_abi_push_freg): Likewise. (ppc64_sysv_abi_return_value_base): Likewise. * rs6000-aix-tdep.c: Include "target-float.h". (rs6000_push_dummy_call): Use target_float_convert. (rs6000_return_value): Likewise. * rs6000-lynx178-tdep.c: Include "target-float.h". (rs6000_lynx178_push_dummy_call): Use target_float_convert. (rs6000_lynx178_return_value): Likewise. * rs6000-tdep.c: Include "target-float.h". Do not include "doublest.h". (rs6000_register_to_value): Use target_float_convert. (rs6000_value_to_register): Likewise. * arm-tdep.c: Include "target-float.h". Do not include "doublest.h". (arm_extract_return_value): Use target_float_convert. (arm_store_return_value): Likewise. * sh-tdep.c: Include "target-float.h". Do not include "doublest.h". (sh_register_convert_to_virtual): Use target_float_convert. (sh_register_convert_to_raw): Likewise. * sh64-tdep.c: Include "target-float.h". (sh64_extract_return_value): Use target_float_convert. (sh64_register_convert_to_virtual): Likewise. (sh64_register_convert_to_raw): Likewise. Fix argument types.
2017-11-06 16:01:37 +01:00
target_float_convert (tmpbuf, arm_ext_type (gdbarch),
valbuf, type);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
break;
case ARM_FLOAT_SOFT_FPA:
case ARM_FLOAT_SOFT_VFP:
/* ARM_FLOAT_VFP can arise if this is a variadic function so
not using the VFP ABI code. */
case ARM_FLOAT_VFP:
regs->cooked_read (ARM_A1_REGNUM, valbuf);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (TYPE_LENGTH (type) > 4)
regs->cooked_read (ARM_A1_REGNUM + 1,
valbuf + ARM_INT_REGISTER_SIZE);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
default:
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
internal_error (__FILE__, __LINE__,
_("arm_extract_return_value: "
"Floating point model not supported"));
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
break;
}
}
else if (type->code () == TYPE_CODE_INT
|| type->code () == TYPE_CODE_CHAR
|| type->code () == TYPE_CODE_BOOL
|| type->code () == TYPE_CODE_PTR
Convert lvalue reference type check to general reference type check In almost all contexts (except for overload resolution rules and expression semantics), lvalue and rvalue references are equivalent. That means that in all but these cases we can replace a TYPE_CODE_REF check to a TYPE_IS_REFERENCE check and, for switch statements, add a case label for a rvalue reference type next to a case label for an lvalue reference type. This patch does exactly that. gdb/ChangeLog PR gdb/14441 * aarch64-tdep.c (aarch64_type_align) (aarch64_extract_return_value, aarch64_store_return_value): Change lvalue reference type checks to general reference type checks. * amd64-tdep.c (amd64_classify): Likewise. * amd64-windows-tdep.c (amd64_windows_passed_by_integer_register): Likewise. * arm-tdep.c (arm_type_align, arm_extract_return_value) (arm_store_return_value): Likewise. * ax-gdb.c (gen_fetch, gen_cast): Likewise. * c-typeprint.c (c_print_type): Likewise. * c-varobj.c (adjust_value_for_child_access, c_value_of_variable) (cplus_number_of_children, cplus_describe_child): Likewise. * compile/compile-c-symbols.c (generate_vla_size): Likewise. * completer.c (expression_completer): Likewise. * cp-support.c (make_symbol_overload_list_adl_namespace): Likewise. * darwin-nat-info.c (info_mach_region_command): Likewise. * dwarf2loc.c (entry_data_value_coerce_ref) (value_of_dwarf_reg_entry): Likewise. * eval.c (ptrmath_type_p, evaluate_subexp_standard) (evaluate_subexp_for_address, evaluate_subexp_for_sizeof): Likewise. * findvar.c (extract_typed_address, store_typed_address): Likewise. * gdbtypes.c (rank_one_type): Likewise. * hppa-tdep.c (hppa64_integral_or_pointer_p): Likewise. * infcall.c (value_arg_coerce): Likewise. * language.c (pointer_type): Likewise. * m32c-tdep.c (m32c_reg_arg_type, m32c_m16c_address_to_pointer): Likewise. * m88k-tdep.c (m88k_integral_or_pointer_p): Likewise. * mn10300-tdep.c (mn10300_type_align): Likewise. * msp430-tdep.c (msp430_push_dummy_call): Likewise. * ppc-sysv-tdep.c (do_ppc_sysv_return_value) (ppc64_sysv_abi_push_param, ppc64_sysv_abi_return_value): Likewise. * printcmd.c (print_formatted, x_command): Likewise. * python/py-type.c (typy_get_composite, typy_template_argument): Likewise. * python/py-value.c (valpy_referenced_value) (valpy_get_dynamic_type, value_has_field): Likewise. * s390-linux-tdep.c (s390_function_arg_integer): Likewise. * sparc-tdep.c (sparc_integral_or_pointer_p): Likewise. * sparc64-tdep.c (sparc64_integral_or_pointer_p): Likewise. * spu-tdep.c (spu_scalar_value_p): Likewise. * symtab.c (lookup_symbol_aux): Likewise. * typeprint.c (whatis_exp, print_type_scalar): Likewise. * valarith.c (binop_types_user_defined_p, unop_user_defined_p): Likewise. * valops.c (value_cast_pointers, value_cast) (value_reinterpret_cast, value_dynamic_cast, value_addr, typecmp) (value_struct_elt, value_struct_elt_bitpos) (value_find_oload_method_list, find_overload_match) (value_rtti_indirect_type): Likewise. * valprint.c (val_print_scalar_type_p, generic_val_print): Likewise. * value.c (value_actual_type, value_as_address, unpack_long) (pack_long, pack_unsigned_long, coerce_ref_if_computed) (coerce_ref): Likewise. * varobj.c (varobj_get_value_type): Likewise.
2017-03-20 21:47:54 +01:00
|| TYPE_IS_REFERENCE (type)
|| type->code () == TYPE_CODE_ENUM)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
/* If the type is a plain integer, then the access is
straight-forward. Otherwise we have to play around a bit
more. */
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
int len = TYPE_LENGTH (type);
int regno = ARM_A1_REGNUM;
ULONGEST tmp;
while (len > 0)
{
/* By using store_unsigned_integer we avoid having to do
anything special for small big-endian values. */
regcache_cooked_read_unsigned (regs, regno++, &tmp);
store_unsigned_integer (valbuf,
(len > ARM_INT_REGISTER_SIZE
? ARM_INT_REGISTER_SIZE : len),
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
byte_order, tmp);
len -= ARM_INT_REGISTER_SIZE;
valbuf += ARM_INT_REGISTER_SIZE;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
}
else
{
/* For a structure or union the behaviour is as if the value had
been stored to word-aligned memory and then loaded into
registers with 32-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int regno = ARM_A1_REGNUM;
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
while (len > 0)
{
regs->cooked_read (regno++, tmpbuf);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
memcpy (valbuf, tmpbuf,
len > ARM_INT_REGISTER_SIZE ? ARM_INT_REGISTER_SIZE : len);
len -= ARM_INT_REGISTER_SIZE;
valbuf += ARM_INT_REGISTER_SIZE;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
}
}
}
/* Will a function return an aggregate type in memory or in a
register? Return 0 if an aggregate type can be returned in a
register, 1 if it must be returned in memory. */
static int
arm_return_in_memory (struct gdbarch *gdbarch, struct type *type)
{
enum type_code code;
Remove CHECK_TYPEDEF, use check_typedef instead I think that the CHECK_TYPEDEF macro is not necessary, and even a bit annoying. It makes unclear the fact that the "type" variables gets overwritten. It has actually bitten me a few times. I think the following, explicit form, is better. type = check_typedef (type); This patches changes all instances of CHECK_TYPEDEF for an equivalent call to check_typedef. The bulk of the change was done with this sed: sed -i 's/CHECK_TYPEDEF (\([^)]*\));/\1 = check_typedef (\1);/' <file>.c The ChangeLog was generated using David Malcom's generate_changelog.py. I manually fixed those places where it gets the wrong function name, hopefully all of them. The patch was built-tested, and I ran a few smoke tests. gdb/ChangeLog: * gdbtypes.h (CHECK_TYPEDEF): Remove. * aarch64-tdep.c (aarch64_return_in_memory): Replace CHECK_TYPEDEF with check_typedef. * ada-lang.c (decode_constrained_packed_array_type): Likewise. (ada_array_length): Likewise. (find_parallel_type_by_descriptive_type): Likewise. (ada_check_typedef): Likewise. * arm-tdep.c (arm_return_in_memory): Likewise. * ax-gdb.c (gen_trace_static_fields): Likewise. (gen_struct_ref_recursive): Likewise. * c-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. (variable: block COLONCOLON name): Likewise. (qualified_name: TYPENAME COLONCOLON name): Likewise. * c-lang.c (classify_type): Likewise. * c-typeprint.c (c_print_type): Likewise. (c_print_typedef): Likewise. (c_type_print_base): Likewise. * c-valprint.c (c_val_print): Likewise. * compile/compile-c-types.c (convert_type): Likewise. * compile/compile-object-load.c (get_out_value_type): Likewise. * completer.c (add_struct_fields): Likewise. (expression_completer): Likewise. * cp-namespace.c (cp_find_type_baseclass_by_name): Likewise. (cp_lookup_nested_symbol_1): Likewise. (cp_lookup_nested_symbol): Likewise. * cp-valprint.c (cp_print_value_fields): Likewise. (cp_print_static_field): Likewise. * d-valprint.c (d_val_print): Likewise. * eval.c (evaluate_subexp_standard): Likewise. (evaluate_subexp_for_sizeof): Likewise. * f-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. * f-typeprint.c (f_type_print_base): Likewise. * f-valprint.c (f_val_print): Likewise. * gdbtypes.c (get_discrete_bounds): Likewise. (create_array_type_with_stride): Likewise. (type_name_no_tag_or_error): Likewise. (lookup_struct_elt_type): Likewise. (get_unsigned_type_max): Likewise. (internal_type_vptr_fieldno): Likewise. (set_type_vptr_fieldno): Likewise. (internal_type_vptr_basetype): Likewise. (set_type_vptr_basetype): Likewise. (get_vptr_fieldno): Likewise. (is_integral_type): Likewise. (is_scalar_type): Likewise. (is_scalar_type_recursive): Likewise. (distance_to_ancestor): Likewise. (is_unique_ancestor_worker): Likewise. (check_types_equal): Likewise. * gnu-v2-abi.c (gnuv2_value_rtti_type): Likewise. * gnu-v3-abi.c (gnuv3_dynamic_class): Likewise. (gnuv3_get_vtable): Likewise. (gnuv3_pass_by_reference): Likewise. * go-exp.y (exp : SIZEOF_KEYWORD '(' type ')' %prec UNARY): Likewise. * go-lang.c (gccgo_string_p): Likewise. (go_classify_struct_type): Likewise. * go-typeprint.c (go_print_type): Likewise. * go-valprint.c (go_val_print): Likewise. * guile/scm-math.c (vlscm_binop): Likewise. * guile/scm-value.c (gdbscm_value_dynamic_type): Likewise. (gdbscm_value_to_bytevector): Likewise. (gdbscm_value_to_bool): Likewise. (gdbscm_value_to_integer): Likewise. (gdbscm_value_to_real): Likewise. * infcall.c (call_function_by_hand_dummy): Likewise. * infcmd.c (get_return_value): Likewise. * jv-lang.c (is_object_type): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_print_value_fields): Likewise. (java_val_print): Likewise. * linespec.c (find_methods): Likewise. (collect_one_symbol): Likewise. * m2-typeprint.c (m2_print_type): Likewise. (m2_print_typedef): Likewise. (m2_get_discrete_bounds): Likewise. * m2-valprint.c (m2_print_long_set): Likewise. (m2_print_unbounded_array): Likewise. (m2_print_array_contents): Likewise. (m2_val_print): Likewise. * opencl-lang.c (opencl_print_type): Likewise. * p-exp.y (exp : SIZEOF '(' type ')' %prec UNARY): Likewise. * p-typeprint.c (pascal_print_type): Likewise. (pascal_print_typedef): Likewise. (pascal_type_print_base): Likewise. * p-valprint.c (pascal_val_print): Likewise. (pascal_object_print_value_fields): Likewise. (pascal_object_print_static_field): Likewise. * python/py-type.c (typy_fields_items): Likewise. (typy_get_composite): Likewise. * python/py-value.c (valpy_get_dynamic_type): Likewise. (valpy_binop): Likewise. (valpy_long): Likewise. (valpy_float): Likewise. * stack.c (return_command): Likewise. * symtab.c (check_field): Likewise. (lookup_symbol_aux): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * typeprint.c (print_type_scalar): Likewise. * valarith.c (value_vector_widen): Likewise. * valops.c (value_cast): Likewise. (value_assign): Likewise. (do_search_struct_field): Likewise. (search_struct_method): Likewise. (find_method_list): Likewise. * valprint.c (val_print_scalar_type_p): Likewise. (valprint_check_validity): Likewise. (generic_val_print): Likewise. * value.c (unpack_double): Likewise. (value_primitive_field): Likewise. (unpack_bits_as_long): Likewise.
2015-07-06 22:05:06 +02:00
type = check_typedef (type);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Simple, non-aggregate types (ie not including vectors and
complex) are always returned in a register (or registers). */
code = type->code ();
if (TYPE_CODE_STRUCT != code && TYPE_CODE_UNION != code
&& TYPE_CODE_ARRAY != code && TYPE_CODE_COMPLEX != code)
return 0;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
if (TYPE_CODE_ARRAY == code && TYPE_VECTOR (type))
{
/* Vector values should be returned using ARM registers if they
are not over 16 bytes. */
return (TYPE_LENGTH (type) > 16);
}
if (gdbarch_tdep (gdbarch)->arm_abi != ARM_ABI_APCS)
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
{
/* The AAPCS says all aggregates not larger than a word are returned
in a register. */
if (TYPE_LENGTH (type) <= ARM_INT_REGISTER_SIZE)
return 0;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
return 1;
}
else
{
int nRc;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* All aggregate types that won't fit in a register must be returned
in memory. */
if (TYPE_LENGTH (type) > ARM_INT_REGISTER_SIZE)
return 1;
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* In the ARM ABI, "integer" like aggregate types are returned in
registers. For an aggregate type to be integer like, its size
must be less than or equal to ARM_INT_REGISTER_SIZE and the
offset of each addressable subfield must be zero. Note that bit
fields are not addressable, and all addressable subfields of
unions always start at offset zero.
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
This function is based on the behaviour of GCC 2.95.1.
See: gcc/arm.c: arm_return_in_memory() for details.
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
Note: All versions of GCC before GCC 2.95.2 do not set up the
parameters correctly for a function returning the following
structure: struct { float f;}; This should be returned in memory,
not a register. Richard Earnshaw sent me a patch, but I do not
know of any way to detect if a function like the above has been
compiled with the correct calling convention. */
/* Assume all other aggregate types can be returned in a register.
Run a check for structures, unions and arrays. */
nRc = 0;
if ((TYPE_CODE_STRUCT == code) || (TYPE_CODE_UNION == code))
{
int i;
/* Need to check if this struct/union is "integer" like. For
this to be true, its size must be less than or equal to
ARM_INT_REGISTER_SIZE and the offset of each addressable
subfield must be zero. Note that bit fields are not
addressable, and unions always start at offset zero. If any
of the subfields is a floating point type, the struct/union
cannot be an integer type. */
/* For each field in the object, check:
1) Is it FP? --> yes, nRc = 1;
2) Is it addressable (bitpos != 0) and
not packed (bitsize == 0)?
--> yes, nRc = 1
*/
for (i = 0; i < type->num_fields (); i++)
{
enum type_code field_type_code;
field_type_code
= check_typedef (type->field (i).type ())->code ();
/* Is it a floating point type field? */
if (field_type_code == TYPE_CODE_FLT)
{
nRc = 1;
break;
}
/* If bitpos != 0, then we have to care about it. */
if (TYPE_FIELD_BITPOS (type, i) != 0)
{
/* Bitfields are not addressable. If the field bitsize is
zero, then the field is not packed. Hence it cannot be
a bitfield or any other packed type. */
if (TYPE_FIELD_BITSIZE (type, i) == 0)
{
nRc = 1;
break;
}
}
}
}
return nRc;
}
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* Write into appropriate registers a function return value of type
TYPE, given in virtual format. */
static void
arm_store_return_value (struct type *type, struct regcache *regs,
const gdb_byte *valbuf)
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
struct gdbarch *gdbarch = regs->arch ();
* 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 19:25:59 +02:00
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
* alpha-tdep.c (alpha_heuristic_proc_start) (alpha_sigtramp_register_address): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. (alpha_heuristic_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_heuristic_proc_start call. (alpha_sigtramp_frame_this_id, alpha_sigtramp_frame_prev_register): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_sigtramp_register_address call. * arm-tdep.c (thumb_scan_prologue): Add gdbarch as parameter and replace current_gdbarch by gdbarch. Update caller. (convert_to_extended, convert_from_extended): Add endianess parameter for comparison. Update caller. (arm_extract_return_value, arm_store_return_value): Use get_regcache_arch to get at the current architecture. * cris-tdep.c (cris_register_size): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. (cris_gdb_func, move_to_preg_op, none_reg_mode_move_from_preg_op): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM, E_PSEUDO_EXR_REGNUM, BINWORD): Add gdbarch as parameter. Update caller. (h8300_init_frame_cache): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and update caller. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_trampoline_code): Use get_frame_arch to get at the current architecture. Replace current_gdbarch by gdbarch. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. (STACK_CORRECTION, USE_PAGE_REGISTER): Replace M6811_TDEP by its expression. Add gdbarch as parameter and replace current_gdbarch with it. Update caller. (M6811_TDEP): Remove. (m68hc11_frame_prev_register): Use get_frame_arch to get at the current architecture. (m68hc11_scan_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * m68k-tdep.c (m68k_analyze_prologue): Add gdbarch as parameter and update caller. (m68k_analyze_register_saves): Likewise. Also replace current_gdbarch by gdbarch. * rs6000-tdep.c (skip_prologue): Add gdbarch as parameter and update caller. Relace current_gdbarch by gdbarch. (altivec_register_p, spe_register_p): Likewise. * ppc-tdep.h (altivec_register_p, spe_register_p): Add gdbarch as parameter. * ppc-linux-nat.c (fetch_register, store_register): Update caller of altivec_register_p and spe_register_p. * score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. (score_analyze_prologue): use get_frame_arch to get at the current architecture. * sparc-tdep.h (sparc_analyze_prologue): Add gdbarch as parameter. * sparc-tdep.c (sparc_analyze_prologue): Likewise. Replace current_gdbarch by gdbarch. Update caller. (sparc_frame_cache): Use get_frame_arch to get at the current architecture. * sparce64-tdep.c (sparc64_skip_prologue): Update call of sparc_analyze_prologue. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Add gdbarch as parameter.
2008-01-11 15:43:15 +01:00
if (type->code () == TYPE_CODE_FLT)
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
{
gdb_byte buf[ARM_FP_REGISTER_SIZE];
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
* alpha-tdep.c (alpha_heuristic_proc_start) (alpha_sigtramp_register_address): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. (alpha_heuristic_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_heuristic_proc_start call. (alpha_sigtramp_frame_this_id, alpha_sigtramp_frame_prev_register): Use get_frame_arch to get at the current architecture by frame_info. Update alpha_sigtramp_register_address call. * arm-tdep.c (thumb_scan_prologue): Add gdbarch as parameter and replace current_gdbarch by gdbarch. Update caller. (convert_to_extended, convert_from_extended): Add endianess parameter for comparison. Update caller. (arm_extract_return_value, arm_store_return_value): Use get_regcache_arch to get at the current architecture. * cris-tdep.c (cris_register_size): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. (cris_gdb_func, move_to_preg_op, none_reg_mode_move_from_preg_op): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. * h8300-tdep.c (E_PSEUDO_CCR_REGNUM, E_PSEUDO_EXR_REGNUM, BINWORD): Add gdbarch as parameter. Update caller. (h8300_init_frame_cache): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * hppa-tdep.c (skip_prologue_hard_way): Add gdbarch as parameter and update caller. Replace current_gdbarch by gdbarch. * m32c-tdep.c (m32c_skip_trampoline_code): Use get_frame_arch to get at the current architecture. Replace current_gdbarch by gdbarch. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. (STACK_CORRECTION, USE_PAGE_REGISTER): Replace M6811_TDEP by its expression. Add gdbarch as parameter and replace current_gdbarch with it. Update caller. (M6811_TDEP): Remove. (m68hc11_frame_prev_register): Use get_frame_arch to get at the current architecture. (m68hc11_scan_prologue): Add gdbarch as parameter. Replace current_gdbarch by gdbarch. Update caller. * m68k-tdep.c (m68k_analyze_prologue): Add gdbarch as parameter and update caller. (m68k_analyze_register_saves): Likewise. Also replace current_gdbarch by gdbarch. * rs6000-tdep.c (skip_prologue): Add gdbarch as parameter and update caller. Relace current_gdbarch by gdbarch. (altivec_register_p, spe_register_p): Likewise. * ppc-tdep.h (altivec_register_p, spe_register_p): Add gdbarch as parameter. * ppc-linux-nat.c (fetch_register, store_register): Update caller of altivec_register_p and spe_register_p. * score-tdep.c (score_fetch_inst): Add gdbarch as parameter. Update caller. Replace current_gdbarch by gdbarch. (score_analyze_prologue): use get_frame_arch to get at the current architecture. * sparc-tdep.h (sparc_analyze_prologue): Add gdbarch as parameter. * sparc-tdep.c (sparc_analyze_prologue): Likewise. Replace current_gdbarch by gdbarch. Update caller. (sparc_frame_cache): Use get_frame_arch to get at the current architecture. * sparce64-tdep.c (sparc64_skip_prologue): Update call of sparc_analyze_prologue. * mn10300-tdep.c (mn10300_dwarf2_reg_to_regnum): Add gdbarch as parameter.
2008-01-11 15:43:15 +01:00
switch (gdbarch_tdep (gdbarch)->fp_model)
{
case ARM_FLOAT_FPA:
Target FP: Remove convert_typed_floating from tdep files This patch mechanically replaces convert_typed_floating with the equivalent target_float_convert throughout tdep files, to prepare for the removal of doublest.{c,h}. No functional change intended. gdb/ChangeLog: 2017-11-06 Ulrich Weigand <uweigand@de.ibm.com> * i386-tdep.c: Include "target-float.h". Do not include "doublest.h". (i386_extract_return_value): Use target_float_convert. (i386_store_return_value): Likewise. * i387-tdep.c (i387_register_to_value): Use target_float_convert. (i387_value_to_register): Likewise. * ia64-tdep.c: Include "target-float.h". Do not include "doublest.h". (ia64_register_to_value): Use target_float_convert. (ia64_value_to_register): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (ia64_push_dummy_call): Likewise. * m68k-tdep.c: Include "target-float.h". (m68k_register_to_value): Use target_float_convert. (m68k_value_to_register): Likewise. (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * ppc-sysv-tdep.c: Include "target-float.h". (ppc_sysv_abi_push_dummy_call): Use target_float_convert. (do_ppc_sysv_return_value): Likewise. (ppc64_sysv_abi_push_freg): Likewise. (ppc64_sysv_abi_return_value_base): Likewise. * rs6000-aix-tdep.c: Include "target-float.h". (rs6000_push_dummy_call): Use target_float_convert. (rs6000_return_value): Likewise. * rs6000-lynx178-tdep.c: Include "target-float.h". (rs6000_lynx178_push_dummy_call): Use target_float_convert. (rs6000_lynx178_return_value): Likewise. * rs6000-tdep.c: Include "target-float.h". Do not include "doublest.h". (rs6000_register_to_value): Use target_float_convert. (rs6000_value_to_register): Likewise. * arm-tdep.c: Include "target-float.h". Do not include "doublest.h". (arm_extract_return_value): Use target_float_convert. (arm_store_return_value): Likewise. * sh-tdep.c: Include "target-float.h". Do not include "doublest.h". (sh_register_convert_to_virtual): Use target_float_convert. (sh_register_convert_to_raw): Likewise. * sh64-tdep.c: Include "target-float.h". (sh64_extract_return_value): Use target_float_convert. (sh64_register_convert_to_virtual): Likewise. (sh64_register_convert_to_raw): Likewise. Fix argument types.
2017-11-06 16:01:37 +01:00
target_float_convert (valbuf, type, buf, arm_ext_type (gdbarch));
regs->cooked_write (ARM_F0_REGNUM, buf);
break;
case ARM_FLOAT_SOFT_FPA:
case ARM_FLOAT_SOFT_VFP:
/* ARM_FLOAT_VFP can arise if this is a variadic function so
not using the VFP ABI code. */
case ARM_FLOAT_VFP:
regs->cooked_write (ARM_A1_REGNUM, valbuf);
if (TYPE_LENGTH (type) > 4)
regs->cooked_write (ARM_A1_REGNUM + 1,
valbuf + ARM_INT_REGISTER_SIZE);
break;
default:
internal_error (__FILE__, __LINE__,
_("arm_store_return_value: Floating "
"point model not supported"));
break;
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
}
else if (type->code () == TYPE_CODE_INT
|| type->code () == TYPE_CODE_CHAR
|| type->code () == TYPE_CODE_BOOL
|| type->code () == TYPE_CODE_PTR
Convert lvalue reference type check to general reference type check In almost all contexts (except for overload resolution rules and expression semantics), lvalue and rvalue references are equivalent. That means that in all but these cases we can replace a TYPE_CODE_REF check to a TYPE_IS_REFERENCE check and, for switch statements, add a case label for a rvalue reference type next to a case label for an lvalue reference type. This patch does exactly that. gdb/ChangeLog PR gdb/14441 * aarch64-tdep.c (aarch64_type_align) (aarch64_extract_return_value, aarch64_store_return_value): Change lvalue reference type checks to general reference type checks. * amd64-tdep.c (amd64_classify): Likewise. * amd64-windows-tdep.c (amd64_windows_passed_by_integer_register): Likewise. * arm-tdep.c (arm_type_align, arm_extract_return_value) (arm_store_return_value): Likewise. * ax-gdb.c (gen_fetch, gen_cast): Likewise. * c-typeprint.c (c_print_type): Likewise. * c-varobj.c (adjust_value_for_child_access, c_value_of_variable) (cplus_number_of_children, cplus_describe_child): Likewise. * compile/compile-c-symbols.c (generate_vla_size): Likewise. * completer.c (expression_completer): Likewise. * cp-support.c (make_symbol_overload_list_adl_namespace): Likewise. * darwin-nat-info.c (info_mach_region_command): Likewise. * dwarf2loc.c (entry_data_value_coerce_ref) (value_of_dwarf_reg_entry): Likewise. * eval.c (ptrmath_type_p, evaluate_subexp_standard) (evaluate_subexp_for_address, evaluate_subexp_for_sizeof): Likewise. * findvar.c (extract_typed_address, store_typed_address): Likewise. * gdbtypes.c (rank_one_type): Likewise. * hppa-tdep.c (hppa64_integral_or_pointer_p): Likewise. * infcall.c (value_arg_coerce): Likewise. * language.c (pointer_type): Likewise. * m32c-tdep.c (m32c_reg_arg_type, m32c_m16c_address_to_pointer): Likewise. * m88k-tdep.c (m88k_integral_or_pointer_p): Likewise. * mn10300-tdep.c (mn10300_type_align): Likewise. * msp430-tdep.c (msp430_push_dummy_call): Likewise. * ppc-sysv-tdep.c (do_ppc_sysv_return_value) (ppc64_sysv_abi_push_param, ppc64_sysv_abi_return_value): Likewise. * printcmd.c (print_formatted, x_command): Likewise. * python/py-type.c (typy_get_composite, typy_template_argument): Likewise. * python/py-value.c (valpy_referenced_value) (valpy_get_dynamic_type, value_has_field): Likewise. * s390-linux-tdep.c (s390_function_arg_integer): Likewise. * sparc-tdep.c (sparc_integral_or_pointer_p): Likewise. * sparc64-tdep.c (sparc64_integral_or_pointer_p): Likewise. * spu-tdep.c (spu_scalar_value_p): Likewise. * symtab.c (lookup_symbol_aux): Likewise. * typeprint.c (whatis_exp, print_type_scalar): Likewise. * valarith.c (binop_types_user_defined_p, unop_user_defined_p): Likewise. * valops.c (value_cast_pointers, value_cast) (value_reinterpret_cast, value_dynamic_cast, value_addr, typecmp) (value_struct_elt, value_struct_elt_bitpos) (value_find_oload_method_list, find_overload_match) (value_rtti_indirect_type): Likewise. * valprint.c (val_print_scalar_type_p, generic_val_print): Likewise. * value.c (value_actual_type, value_as_address, unpack_long) (pack_long, pack_unsigned_long, coerce_ref_if_computed) (coerce_ref): Likewise. * varobj.c (varobj_get_value_type): Likewise.
2017-03-20 21:47:54 +01:00
|| TYPE_IS_REFERENCE (type)
|| type->code () == TYPE_CODE_ENUM)
{
if (TYPE_LENGTH (type) <= 4)
{
/* Values of one word or less are zero/sign-extended and
returned in r0. */
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
LONGEST val = unpack_long (type, valbuf);
store_signed_integer (tmpbuf, ARM_INT_REGISTER_SIZE, byte_order, val);
regs->cooked_write (ARM_A1_REGNUM, tmpbuf);
}
else
{
/* Integral values greater than one word are stored in consecutive
registers starting with r0. This will always be a multiple of
the regiser size. */
int len = TYPE_LENGTH (type);
int regno = ARM_A1_REGNUM;
while (len > 0)
{
regs->cooked_write (regno++, valbuf);
len -= ARM_INT_REGISTER_SIZE;
valbuf += ARM_INT_REGISTER_SIZE;
}
}
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
else
{
/* For a structure or union the behaviour is as if the value had
been stored to word-aligned memory and then loaded into
registers with 32-bit load instruction(s). */
int len = TYPE_LENGTH (type);
int regno = ARM_A1_REGNUM;
bfd_byte tmpbuf[ARM_INT_REGISTER_SIZE];
while (len > 0)
{
memcpy (tmpbuf, valbuf,
len > ARM_INT_REGISTER_SIZE ? ARM_INT_REGISTER_SIZE : len);
regs->cooked_write (regno++, tmpbuf);
len -= ARM_INT_REGISTER_SIZE;
valbuf += ARM_INT_REGISTER_SIZE;
}
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
}
/* Handle function return values. */
static enum return_value_convention
gdb/ * breakpoint.h (bp_location): Add related_address member. * inferior.h (get_return_value): Take a pointer to struct value instead of struct type for the function requested. * value.h (using_struct_return): Likewise. * gdbarch.sh (return_value): Take a pointer to struct value instead of struct type for the function requested. * breakpoint.c (set_breakpoint_location_function): Initialize related_address for bp_gnu_ifunc_resolver breakpoints. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the requested function's address to gdbarch_return_value. * eval.c (evaluate_subexp_standard): Pass the requested function's address to using_struct_return. * infcall.c (call_function_by_hand): Pass the requested function's address to using_struct_return and gdbarch_return_value. * infcmd.c (get_return_value): Take a pointer to struct value instead of struct type for the function requested. (print_return_value): Update accordingly. (finish_command_continuation): Likewise. * stack.c (return_command): Pass the requested function's address to using_struct_return and gdbarch_return_value. * value.c (using_struct_return): Take a pointer to struct value instead of struct type for the function requested. Pass the requested function's address to gdbarch_return_value. * python/py-finishbreakpoint.c (finish_breakpoint_object): New function_value member, replacing function_type. (bpfinishpy_dealloc): Update accordingly. (bpfinishpy_pre_stop_hook): Likewise. (bpfinishpy_init): Likewise. Record the requested function's address. * mips-tdep.c (mips_fval_reg): New enum. (mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap words put in GP registers. (mips_o64_push_dummy_call): Update a comment. (mips_o32_return_value): Take a pointer to struct value instead of struct type for the function requested and use it to check if using the MIPS16 calling convention. Return the designated general purpose registers for floating-point values returned in MIPS16 mode. (mips_o64_return_value): Likewise. * ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * alpha-tdep.c (alpha_return_value): Take a pointer to struct value instead of struct type for the function requested. * amd64-tdep.c (amd64_return_value): Likewise. * amd64-windows-tdep.c (amd64_windows_return_value): Likewise. * arm-tdep.c (arm_return_value): Likewise. * avr-tdep.c (avr_return_value): Likewise. * bfin-tdep.c (bfin_return_value): Likewise. * cris-tdep.c (cris_return_value): Likewise. * frv-tdep.c (frv_return_value): Likewise. * h8300-tdep.c (h8300_return_value): Likewise. (h8300h_return_value): Likewise. * hppa-tdep.c (hppa32_return_value): Likewise. (hppa64_return_value): Likewise. * i386-tdep.c (i386_return_value): Likewise. * ia64-tdep.c (ia64_return_value): Likewise. * iq2000-tdep.c (iq2000_return_value): Likewise. * lm32-tdep.c (lm32_return_value): Likewise. * m32c-tdep.c (m32c_return_value): Likewise. * m32r-tdep.c (m32r_return_value): Likewise. * m68hc11-tdep.c (m68hc11_return_value): Likewise. * m68k-tdep.c (m68k_return_value): Likewise. (m68k_svr4_return_value): Likewise. * m88k-tdep.c (m88k_return_value): Likewise. * mep-tdep.c (mep_return_value): Likewise. * microblaze-tdep.c (microblaze_return_value): Likewise. * mn10300-tdep.c (mn10300_return_value): Likewise. * moxie-tdep.c (moxie_return_value): Likewise. * mt-tdep.c (mt_return_value): Likewise. * ppc-linux-tdep.c (ppc_linux_return_value): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise. * rl78-tdep.c (rl78_return_value): Likewise. * rs6000-aix-tdep.c (rs6000_return_value): Likewise. * rx-tdep.c (rx_return_value): Likewise. * s390-tdep.c (s390_return_value): Likewise. * score-tdep.c (score_return_value): Likewise. * sh-tdep.c (sh_return_value_nofpu): Likewise. (sh_return_value_fpu): Likewise. * sh64-tdep.c (sh64_return_value): Likewise. * sparc-tdep.c (sparc32_return_value): Likewise. * sparc64-tdep.c (sparc64_return_value): Likewise. * spu-tdep.c (spu_return_value): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * v850-tdep.c (v850_return_value): Likewise. * vax-tdep.c (vax_return_value): Likewise. * xstormy16-tdep.c (xstormy16_return_value): Likewise. * xtensa-tdep.c (xtensa_return_value): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/testsuite/ * gdb.base/return-nodebug.exp: Also test float and double types.
2012-05-16 16:35:09 +02:00
arm_return_value (struct gdbarch *gdbarch, struct value *function,
doc/ChangeLog: -------------- * gdb.texinfo (Set SH Calling convention): New @item. (Show SH Calling convention): Ditto. ChangeLog: ---------- * NEWS: Add information on calling convention and new SH CLI options. * sh-tdep.c (sh_cc_gcc): New static string. (sh_cc_renesas): Ditto. (sh_cc_enum): New static string array. (sh_active_calling_convention): New static string pointer denoting active user chosen ABI. (sh_is_renesas_calling_convention): New function to return function specific ABI, or user choice if necessary. (sh_use_struct_convention): Rename first argument and turn around its meaning. Check for renesas ABI and return accordingly. (sh_use_struct_convention_nofpu): New function. (sh_next_flt_argreg): Get function type as third parameter. Check for renesas ABI and choose floating registers accordingly. (sh_push_dummy_call_fpu): Check for ABI and choose argument slot and struct return slot accordingly. (sh_push_dummy_call_nofpu): Ditto. (sh_return_value_nofpu): Call sh_use_struct_convention_nofpu from here. Evaluate ABI and give to sh_use_struct_convention_nofpu. (sh_return_value_fpu): Evaluate ABI and give to sh_use_struct_convention. (show_sh_command): New function. (set_sh_command): Ditto. (_initialize_sh_tdep): Initialize `set/show sh calling-convention CLI command. * gdbarch.sh (return_value): Add func_type argument. * gdbarch.c: Regenerate. * gdbarch.h: Ditto. * eval.c (evaluate_subexp_standard): Rename local variable value_type to val_type so as not to collide with value_type function. Call using_struct_return with additional function type argument. * infcall.c (call_function_by_hand): Call using_struct_return and gdbarch_return_value with additional function type argument. * infcmd.c (print_return_value): Take addition func_type argument. Call gdbarch_return_value with additional function type argument. (finish_command_continuation): Call print_return_value with additional function type argument. (finish_command): Ditto. * sparc-tdep.c (sparc32_push_dummy_code): Call using_struct_return with additional function type argument. * stack.c (return_command): Call using_struct_return and gdbarch_return_value with additional function type argument. * value.c (using_struct_return): Take additional function type argument. * value.h (using_struct_return): Accommodate declaration. * alpha-tdep.c (alpha_return_value): Add func_type argument. * amd64-tdep.c (amd64_return_value): Ditto. * arm-tdep.c (arm_return_value): Ditto. * avr-tdep.c (avr_return_value): Ditto. * cris-tdep.c (cris_return_value): Ditto. * frv-tdep.c (frv_return_value): Ditto. * h8300-tdep.c (h8300_return_value): Ditto. (h8300h_return_value): Ditto. * hppa-tdep.c (hppa32_return_value): Ditto. (hppa64_return_value): Ditto. * i386-tdep.c (i386_return_value): Ditto. * ia64-tdep.c (ia64_return_value): Ditto. * iq2000-tdep.c (iq2000_return_value): Ditto. * m32c-tdep.c (m32c_return_value): Ditto. * m32r-tdep.c (m32r_return_value): Ditto. * m68hc11-tdep.c (m68hc11_return_value): Ditto. * m68k-tdep.c (m68k_return_value): Ditto. (m68k_svr4_return_value): Ditto. * m88k-tdep.c (m88k_return_value): Ditto. * mep-tdep.c (mep_return_value): Ditto. * mips-tdep.c (mips_eabi_return_value): Ditto. (mips_n32n64_return_value): Ditto. (mips_o32_return_value): Ditto. (mips_o64_return_value): Ditto. * mn10300-tdep.c (mn10300_return_value): Ditto. * mt-tdep.c (mt_return_value): Ditto. * ppc-linux-tdep.c (ppc_linux_return_value): Ditto. * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Ditto. (ppc_sysv_abi_broken_return_value): Ditto. (ppc64_sysv_abi_return_value): Ditto. * ppc-tdep.h (ppc_sysv_abi_return_value): Ditto. (ppc_sysv_abi_broken_return_value): Ditto. (ppc64_sysv_abi_return_value): Ditto. * ppcnbsd-tdep.c (ppcnbsd_return_value): Ditto. * rs6000-tdep.c (rs6000_return_value): Ditto. * s390-tdep.c (s390_return_value): Ditto. * score-tdep.c (score_return_value): Ditto. * sh-tdep.c (sh_return_value_nofpu): Ditto. (sh_return_value_fpu): Ditto. * sh64-tdep.c (sh64_return_value): Ditto. * sparc-tdep.c (sparc32_return_value): Ditto. * sparc64-tdep.c (sparc64_return_value): Ditto. * spu-tdep.c (spu_return_value): Ditto. * v850-tdep.c (v850_return_value): Ditto. * vax-tdep.c (vax_return_value): Ditto. * xstormy16-tdep.c (xstormy16_return_value): Ditto. * xtensa-tdep.c (xtensa_return_value): Ditto. * gdbtypes.h (struct type): Add calling_convention member. * dwarf2read.c (read_subroutine_type): Add calling convention read from DW_AT_calling_convention attribute to function type.
2008-04-22 13:03:42 +02:00
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
gdb/ * breakpoint.h (bp_location): Add related_address member. * inferior.h (get_return_value): Take a pointer to struct value instead of struct type for the function requested. * value.h (using_struct_return): Likewise. * gdbarch.sh (return_value): Take a pointer to struct value instead of struct type for the function requested. * breakpoint.c (set_breakpoint_location_function): Initialize related_address for bp_gnu_ifunc_resolver breakpoints. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the requested function's address to gdbarch_return_value. * eval.c (evaluate_subexp_standard): Pass the requested function's address to using_struct_return. * infcall.c (call_function_by_hand): Pass the requested function's address to using_struct_return and gdbarch_return_value. * infcmd.c (get_return_value): Take a pointer to struct value instead of struct type for the function requested. (print_return_value): Update accordingly. (finish_command_continuation): Likewise. * stack.c (return_command): Pass the requested function's address to using_struct_return and gdbarch_return_value. * value.c (using_struct_return): Take a pointer to struct value instead of struct type for the function requested. Pass the requested function's address to gdbarch_return_value. * python/py-finishbreakpoint.c (finish_breakpoint_object): New function_value member, replacing function_type. (bpfinishpy_dealloc): Update accordingly. (bpfinishpy_pre_stop_hook): Likewise. (bpfinishpy_init): Likewise. Record the requested function's address. * mips-tdep.c (mips_fval_reg): New enum. (mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap words put in GP registers. (mips_o64_push_dummy_call): Update a comment. (mips_o32_return_value): Take a pointer to struct value instead of struct type for the function requested and use it to check if using the MIPS16 calling convention. Return the designated general purpose registers for floating-point values returned in MIPS16 mode. (mips_o64_return_value): Likewise. * ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * alpha-tdep.c (alpha_return_value): Take a pointer to struct value instead of struct type for the function requested. * amd64-tdep.c (amd64_return_value): Likewise. * amd64-windows-tdep.c (amd64_windows_return_value): Likewise. * arm-tdep.c (arm_return_value): Likewise. * avr-tdep.c (avr_return_value): Likewise. * bfin-tdep.c (bfin_return_value): Likewise. * cris-tdep.c (cris_return_value): Likewise. * frv-tdep.c (frv_return_value): Likewise. * h8300-tdep.c (h8300_return_value): Likewise. (h8300h_return_value): Likewise. * hppa-tdep.c (hppa32_return_value): Likewise. (hppa64_return_value): Likewise. * i386-tdep.c (i386_return_value): Likewise. * ia64-tdep.c (ia64_return_value): Likewise. * iq2000-tdep.c (iq2000_return_value): Likewise. * lm32-tdep.c (lm32_return_value): Likewise. * m32c-tdep.c (m32c_return_value): Likewise. * m32r-tdep.c (m32r_return_value): Likewise. * m68hc11-tdep.c (m68hc11_return_value): Likewise. * m68k-tdep.c (m68k_return_value): Likewise. (m68k_svr4_return_value): Likewise. * m88k-tdep.c (m88k_return_value): Likewise. * mep-tdep.c (mep_return_value): Likewise. * microblaze-tdep.c (microblaze_return_value): Likewise. * mn10300-tdep.c (mn10300_return_value): Likewise. * moxie-tdep.c (moxie_return_value): Likewise. * mt-tdep.c (mt_return_value): Likewise. * ppc-linux-tdep.c (ppc_linux_return_value): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise. * rl78-tdep.c (rl78_return_value): Likewise. * rs6000-aix-tdep.c (rs6000_return_value): Likewise. * rx-tdep.c (rx_return_value): Likewise. * s390-tdep.c (s390_return_value): Likewise. * score-tdep.c (score_return_value): Likewise. * sh-tdep.c (sh_return_value_nofpu): Likewise. (sh_return_value_fpu): Likewise. * sh64-tdep.c (sh64_return_value): Likewise. * sparc-tdep.c (sparc32_return_value): Likewise. * sparc64-tdep.c (sparc64_return_value): Likewise. * spu-tdep.c (spu_return_value): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * v850-tdep.c (v850_return_value): Likewise. * vax-tdep.c (vax_return_value): Likewise. * xstormy16-tdep.c (xstormy16_return_value): Likewise. * xtensa-tdep.c (xtensa_return_value): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/testsuite/ * gdb.base/return-nodebug.exp: Also test float and double types.
2012-05-16 16:35:09 +02:00
struct type *func_type = function ? value_type (function) : NULL;
enum arm_vfp_cprc_base_type vfp_base_type;
int vfp_base_count;
if (arm_vfp_abi_for_function (gdbarch, func_type)
&& arm_vfp_call_candidate (valtype, &vfp_base_type, &vfp_base_count))
{
int reg_char = arm_vfp_cprc_reg_char (vfp_base_type);
int unit_length = arm_vfp_cprc_unit_length (vfp_base_type);
int i;
for (i = 0; i < vfp_base_count; i++)
{
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
if (reg_char == 'q')
{
if (writebuf)
arm_neon_quad_write (gdbarch, regcache, i,
writebuf + i * unit_length);
if (readbuf)
arm_neon_quad_read (gdbarch, regcache, i,
readbuf + i * unit_length);
}
else
{
char name_buf[4];
int regnum;
xsnprintf (name_buf, sizeof (name_buf), "%c%d", reg_char, i);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
if (writebuf)
regcache->cooked_write (regnum, writebuf + i * unit_length);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
if (readbuf)
regcache->cooked_read (regnum, readbuf + i * unit_length);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
}
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (valtype->code () == TYPE_CODE_STRUCT
|| valtype->code () == TYPE_CODE_UNION
|| valtype->code () == TYPE_CODE_ARRAY)
{
if (tdep->struct_return == pcc_struct_return
|| arm_return_in_memory (gdbarch, valtype))
return RETURN_VALUE_STRUCT_CONVENTION;
}
else if (valtype->code () == TYPE_CODE_COMPLEX)
{
if (arm_return_in_memory (gdbarch, valtype))
return RETURN_VALUE_STRUCT_CONVENTION;
}
if (writebuf)
arm_store_return_value (valtype, regcache, writebuf);
if (readbuf)
arm_extract_return_value (valtype, regcache, readbuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
static int
arm_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
* 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 19:25:59 +02:00
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;
gdb_byte buf[ARM_INT_REGISTER_SIZE];
jb_addr = get_frame_register_unsigned (frame, ARM_A1_REGNUM);
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
ARM_INT_REGISTER_SIZE))
return 0;
*pc = extract_unsigned_integer (buf, ARM_INT_REGISTER_SIZE, byte_order);
return 1;
}
[gdb][Arm]: gdb cannot step across CMSE secure entry function code. GDB is not able to execute "step" command on function calls of Armv8-M cmse secure entry functions. Everytime GNU linker come across definition of any cmse secure entry function in object file(s), it creates two new instructions secure gateway (sg) and original branch destination (b.w), place those two instructions in ".gnu.sgstubs" section of executable. Any function calls to these cmse secure entry functions is re-directed through secure gateway (sg) present in ".gnu.sgstubs" section. Example: Following is a function call to cmse secure entry function "foo": ... bl xxxx <foo> --->(a) ... <foo> xxxx: push {r7, lr} GNU linker on finding out "foo" is a cmse secure entry function, created sg and b.w instructions and place them in ".gnu.sgstubs" section (marked by c). The "bl" instruction (marked by a) which is a call to cmse secure entry function is modified by GNU linker (as marked by b) and call flow is re-directly through secure gateway (sg) in ".gnu.sgstubs" section. ... bl yyyy <foo> ---> (b) ... section .gnu.sgstubs: ---> (c) yyyy <foo> yyyy: sg // secure gateway b.w xxxx <__acle_se_foo> // original_branch_dest ... 0000xxxx <__acle_se_foo> xxxx: push {r7, lr} ---> (d) On invoking GDB, when the control is at "b" and we pass "step" command, the pc returns "yyyy" (sg address) which is a trampoline and which does not exist in source code. So GDB jumps to next line without jumping to "__acle_se_foo" (marked by d). The above details are published on the Arm website [1], please refer to section 5.4 (Entry functions) and section 3.4.4 (C level development flow of secure code). [1] https://developer.arm.com/architectures/cpu-architecture/m-profile/docs/ecm0359818/latest/armv8-m-security-extensions-requirements-on-development-tools-engineering-specification This patch fixes above problem by returning target pc "xxxx" to GDB on executing "step" command at "b", so that the control jumps to "__acle_se_foo" (marked by d). gdb/ChangeLog: * arm-tdep.c (arm_skip_cmse_entry): New function. (arm_is_sgstubs_section): New function. (arm_skip_stub): Add call to arm_skip_cmse_entry function. gdb/testsuite/ChangeLog: * gdb.arch/arm-cmse-sgstubs.c: New test. * gdb.arch/arm-cmse-sgstubs.exp: New file.
2019-07-23 12:21:11 +02:00
/* A call to cmse secure entry function "foo" at "a" is modified by
GNU ld as "b".
a) bl xxxx <foo>
<foo>
xxxx:
b) bl yyyy <__acle_se_foo>
section .gnu.sgstubs:
<foo>
yyyy: sg // secure gateway
b.w xxxx <__acle_se_foo> // original_branch_dest
<__acle_se_foo>
xxxx:
When the control at "b", the pc contains "yyyy" (sg address) which is a
trampoline and does not exist in source code. This function returns the
target pc "xxxx". For more details please refer to section 5.4
(Entry functions) and section 3.4.4 (C level development flow of secure code)
of "armv8-m-security-extensions-requirements-on-development-tools-engineering-specification"
document on www.developer.arm.com. */
static CORE_ADDR
arm_skip_cmse_entry (CORE_ADDR pc, const char *name, struct objfile *objfile)
{
int target_len = strlen (name) + strlen ("__acle_se_") + 1;
char *target_name = (char *) alloca (target_len);
xsnprintf (target_name, target_len, "%s%s", "__acle_se_", name);
struct bound_minimal_symbol minsym
= lookup_minimal_symbol (target_name, NULL, objfile);
if (minsym.minsym != nullptr)
return BMSYMBOL_VALUE_ADDRESS (minsym);
return 0;
}
/* Return true when SEC points to ".gnu.sgstubs" section. */
static bool
arm_is_sgstubs_section (struct obj_section *sec)
{
return (sec != nullptr
&& sec->the_bfd_section != nullptr
&& sec->the_bfd_section->name != nullptr
&& streq (sec->the_bfd_section->name, ".gnu.sgstubs"));
}
/* Recognize GCC and GNU ld's trampolines. If we are in a trampoline,
return the target PC. Otherwise return 0. */
CORE_ADDR
* gdbarch.sh (skip_trampoline_code): Add FRAME argument. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (generic_skip_trampoline_code): Add FRAME argument. * arch-utils.h (generic_skip_trampoline_code): Likewise. * infrun.c (handle_inferior_event): Pass current frame to gdbarch_skip_trampoline_code and skip_language_trampoline. * language.c (unk_lang_trampoline): Add FRAME argument. (skip_language_trampoline): Add FRAME argument. Pass it to skip_trampoline callback. * language.h: Add forward declaration of struct frame_info. (struct language_defn): Add FRAME argument to skip_trampoline. (skip_language_trampoline): Add FRAME argument. * cp-abi.c (cplus_skip_trampoline): Add FRAME argument. Pass it to skip_trampoline callback. * cp-abi.h: Add forward declaration of struct frame_info. (cplus_skip_trampoline): Add FRAME argument. (struct cp_abi_ops): Add FRAME argument to skip_trampoline callback. * gnu-v3-abi.c (gnuv3_skip_trampoline): Add FRAME argument. Pass it to gdbarch_skip_trampoline_code. * objc-lang.c (objc_skip_trampoline): Add FRAME argument. Pass it to gdbarch_skip_trampoline_code. * minsyms.c (find_solib_trampoline_target): Add FRAME argument. * symtab.h (find_solib_trampoline_target): Likewise. * obsd-tdep.c (obsd_skip_solib_resolver): Pass current frame to find_solib_trampoline_target. * arm-tdep.c (arm_skip_stub): Add FRAME argument. Read registers from FRAME instead of calling read_register. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code): Add FRAME argument. Read registers from FRAME instead of using read_register. * hppa-tdep.c (hppa_skip_trampoline_code): Likewise. * hppa-tdep.h (hppa_skip_trampoline_code): Add FRAME argument. * i386-cygwin-tdep.c (i386_cygwin_skip_trampoline_code): Add FRAME argument. * m32c-tdep.c (m32c_skip_trampoline_code): Add FRAME argument. * mips-tdep.c (mips_skip_trampoline_code): Add FRAME argument. Read registers from FRAME instead of using read_signed_register. * ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Add FRAME argument. (ppc64_standard_linkage_target): Likewise. Read registers from FRAME instead of using read_register. (ppc64_skip_trampoline_code): Add FRAME argument. Pass it to ppc64_standard_linkage_target. * rs6000-tdep.c (rs6000_skip_trampoline_code): Add FRAME argument. Pass it to find_solib_trampoline_target. Read registers from FRAME instead of using read_register. * xstormy16-tdep.c (xstormy16_skip_trampoline_code): Add FRAME argument.
2007-06-16 00:39:52 +02:00
arm_skip_stub (struct frame_info *frame, CORE_ADDR pc)
{
* blockframe.c (find_pc_partial_function_gnu_ifunc): Change type of "name" parameter to const char ** from char **. All callers updated. (find_pc_partial_function): Ditto. (cache_pc_function_name): Change type to const char * from char *. * symtab.h ((find_pc_partial_function_gnu_ifunc): Update. (find_pc_partial_function): Update. * alpha-tdep.h (struct gdbarch_tdep, member pc_in_sigtramp): Change type of "name" parameter to const char * from char *. All uses updated. * arch-utils.c (generic_in_solib_return_trampoline): Change type of "name" parameter to const char * from char *. * arch-utils.h (generic_in_solib_return_trampoline): Update. * frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * gdbarch.sh (in_solib_return_trampoline): Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Update. * rs6000-tdep.c (rs6000_in_solib_return_trampoline): Update. * m32r-linux-tdep.c (m32r_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * skip.c (skip_function_pc): Ditto. * sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Ditto. * sparc-tdep.h (sparc_sol2_pc_in_sigtramp): Update. * sparc64fbsd-tdep.c (sparc64fbsd_pc_in_sigtramp): Ditto. * sparc64nbsd-tdep.c (sparc64nbsd_pc_in_sigtramp): Ditto. * sparc64obsd-tdep.c (sparc64obsd_pc_in_sigtramp): Ditto. * sparcnbsd-tdep.c (sparc32nbsd_pc_in_sigtramp): Ditto. * sparcobsd-tdep.c (sparc32obsd_pc_in_sigtramp): Ditto. * nbsd-tdep.c (nbsd_pc_in_sigtramp): Similary for "func_name". * nbsd-tdep.h (nbsd_pc_in_sigtramp): Update.
2012-02-02 21:19:17 +01:00
const char *name;
int namelen;
CORE_ADDR start_addr;
/* Find the starting address and name of the function containing the PC. */
if (find_pc_partial_function (pc, &name, &start_addr, NULL) == 0)
{
/* Trampoline 'bx reg' doesn't belong to any functions. Do the
check here. */
start_addr = arm_skip_bx_reg (frame, pc);
if (start_addr != 0)
return start_addr;
return 0;
}
/* If PC is in a Thumb call or return stub, return the address of the
target PC, which is in a register. The thunk functions are called
_call_via_xx, where x is the register name. The possible names
are r0-r9, sl, fp, ip, sp, and lr. ARM RealView has similar
functions, named __ARM_call_via_r[0-7]. */
if (startswith (name, "_call_via_")
|| startswith (name, "__ARM_call_via_"))
{
1999-12-22 22:45:38 +01:00
/* Use the name suffix to determine which register contains the
target PC. */
-Wwrite-strings: The Rest This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-04-05 20:21:37 +02:00
static const char *table[15] =
1999-07-07 22:19:36 +02:00
{"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "sl", "fp", "ip", "sp", "lr"
};
int regno;
int offset = strlen (name) - 2;
for (regno = 0; regno <= 14; regno++)
if (strcmp (&name[offset], table[regno]) == 0)
* gdbarch.sh (skip_trampoline_code): Add FRAME argument. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (generic_skip_trampoline_code): Add FRAME argument. * arch-utils.h (generic_skip_trampoline_code): Likewise. * infrun.c (handle_inferior_event): Pass current frame to gdbarch_skip_trampoline_code and skip_language_trampoline. * language.c (unk_lang_trampoline): Add FRAME argument. (skip_language_trampoline): Add FRAME argument. Pass it to skip_trampoline callback. * language.h: Add forward declaration of struct frame_info. (struct language_defn): Add FRAME argument to skip_trampoline. (skip_language_trampoline): Add FRAME argument. * cp-abi.c (cplus_skip_trampoline): Add FRAME argument. Pass it to skip_trampoline callback. * cp-abi.h: Add forward declaration of struct frame_info. (cplus_skip_trampoline): Add FRAME argument. (struct cp_abi_ops): Add FRAME argument to skip_trampoline callback. * gnu-v3-abi.c (gnuv3_skip_trampoline): Add FRAME argument. Pass it to gdbarch_skip_trampoline_code. * objc-lang.c (objc_skip_trampoline): Add FRAME argument. Pass it to gdbarch_skip_trampoline_code. * minsyms.c (find_solib_trampoline_target): Add FRAME argument. * symtab.h (find_solib_trampoline_target): Likewise. * obsd-tdep.c (obsd_skip_solib_resolver): Pass current frame to find_solib_trampoline_target. * arm-tdep.c (arm_skip_stub): Add FRAME argument. Read registers from FRAME instead of calling read_register. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code): Add FRAME argument. Read registers from FRAME instead of using read_register. * hppa-tdep.c (hppa_skip_trampoline_code): Likewise. * hppa-tdep.h (hppa_skip_trampoline_code): Add FRAME argument. * i386-cygwin-tdep.c (i386_cygwin_skip_trampoline_code): Add FRAME argument. * m32c-tdep.c (m32c_skip_trampoline_code): Add FRAME argument. * mips-tdep.c (mips_skip_trampoline_code): Add FRAME argument. Read registers from FRAME instead of using read_signed_register. * ppc-linux-tdep.c (ppc_linux_skip_trampoline_code): Add FRAME argument. (ppc64_standard_linkage_target): Likewise. Read registers from FRAME instead of using read_register. (ppc64_skip_trampoline_code): Add FRAME argument. Pass it to ppc64_standard_linkage_target. * rs6000-tdep.c (rs6000_skip_trampoline_code): Add FRAME argument. Pass it to find_solib_trampoline_target. Read registers from FRAME instead of using read_register. * xstormy16-tdep.c (xstormy16_skip_trampoline_code): Add FRAME argument.
2007-06-16 00:39:52 +02:00
return get_frame_register_unsigned (frame, regno);
}
1999-12-22 22:45:38 +01:00
/* GNU ld generates __foo_from_arm or __foo_from_thumb for
non-interworking calls to foo. We could decode the stubs
to find the target but it's easier to use the symbol table. */
namelen = strlen (name);
if (name[0] == '_' && name[1] == '_'
&& ((namelen > 2 + strlen ("_from_thumb")
&& startswith (name + namelen - strlen ("_from_thumb"), "_from_thumb"))
|| (namelen > 2 + strlen ("_from_arm")
&& startswith (name + namelen - strlen ("_from_arm"), "_from_arm"))))
{
char *target_name;
int target_len = namelen - 2;
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
struct bound_minimal_symbol minsym;
struct objfile *objfile;
struct obj_section *sec;
if (name[namelen - 1] == 'b')
target_len -= strlen ("_from_thumb");
else
target_len -= strlen ("_from_arm");
Add casts to memory allocation related calls Most allocation functions (if not all) return a void* pointing to the allocated memory. In C++, we need to add an explicit cast when assigning the result to a pointer to another type (which is the case more often than not). The content of this patch is taken from Pedro's branch, from commit "(mostly) auto-generated patch to insert casts needed for C++". I validated that the changes make sense and manually reflowed the code to make it respect the coding style. I also found multiple places where I could use XNEW/XNEWVEC/XRESIZEVEC/etc. Thanks a lot to whoever did that automated script to insert casts, doing it completely by hand would have taken a ridiculous amount of time. Only files built on x86 with --enable-targets=all are modified. This means that all other -nat.c files are untouched and will have to be dealt with later by using appropiate compilers. Or maybe we can try to build them with a regular g++ just to know where to add casts, I don't know. I built-tested this with --enable-targets=all and reg-tested. Here's the changelog entry, which was not too bad to make despite the size, thanks to David Malcom's script. I fixed some bits by hand, but there might be some wrong parts left (hopefully not). gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_stap_parse_special_token): Add cast to allocation result assignment. * ada-exp.y (write_object_renaming): Likewise. (write_ambiguous_var): Likewise. (ada_nget_field_index): Likewise. (write_var_or_type): Likewise. * ada-lang.c (ada_decode_symbol): Likewise. (ada_value_assign): Likewise. (value_pointer): Likewise. (cache_symbol): Likewise. (add_nonlocal_symbols): Likewise. (ada_name_for_lookup): Likewise. (symbol_completion_add): Likewise. (ada_to_fixed_type_1): Likewise. (ada_get_next_arg): Likewise. (defns_collected): Likewise. * ada-lex.l (processId): Likewise. (processString): Likewise. * ada-tasks.c (read_known_tasks_array): Likewise. (read_known_tasks_list): Likewise. * ada-typeprint.c (decoded_type_name): Likewise. * addrmap.c (addrmap_mutable_create_fixed): Likewise. * amd64-tdep.c (amd64_push_arguments): Likewise. (amd64_displaced_step_copy_insn): Likewise. (amd64_classify_insn_at): Likewise. (amd64_relocate_instruction): Likewise. * amd64obsd-tdep.c (amd64obsd_sigtramp_p): Likewise. * arch-utils.c (simple_displaced_step_copy_insn): Likewise. (initialize_current_architecture): Likewise. * arm-linux-tdep.c (arm_stap_parse_special_token): Likewise. * arm-symbian-tdep.c (arm_symbian_osabi_sniffer): Likewise. * arm-tdep.c (arm_exidx_new_objfile): Likewise. (arm_push_dummy_call): Likewise. (extend_buffer_earlier): Likewise. (arm_adjust_breakpoint_address): Likewise. (arm_skip_stub): Likewise. * auto-load.c (filename_is_in_pattern): Likewise. (maybe_add_script_file): Likewise. (maybe_add_script_text): Likewise. (auto_load_objfile_script_1): Likewise. * auxv.c (ld_so_xfer_auxv): Likewise. * ax-general.c (new_agent_expr): Likewise. (grow_expr): Likewise. (ax_reg_mask): Likewise. * bcache.c (bcache_full): Likewise. * breakpoint.c (program_breakpoint_here_p): Likewise. * btrace.c (parse_xml_raw): Likewise. * build-id.c (build_id_to_debug_bfd): Likewise. * buildsym.c (end_symtab_with_blockvector): Likewise. * c-exp.y (string_exp): Likewise. (qualified_name): Likewise. (write_destructor_name): Likewise. (operator_stoken): Likewise. (parse_number): Likewise. (scan_macro_expansion): Likewise. (yylex): Likewise. (c_print_token): Likewise. * c-lang.c (c_get_string): Likewise. (emit_numeric_character): Likewise. * charset.c (wchar_iterate): Likewise. * cli/cli-cmds.c (complete_command): Likewise. (make_command): Likewise. * cli/cli-dump.c (restore_section_callback): Likewise. (restore_binary_file): Likewise. * cli/cli-interp.c (cli_interpreter_exec): Likewise. * cli/cli-script.c (execute_control_command): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (add_pe_forwarded_sym): Likewise. (read_pe_exported_syms): Likewise. * coffread.c (coff_read_struct_type): Likewise. (coff_read_enum_type): Likewise. * common/btrace-common.c (btrace_data_append): Likewise. * common/buffer.c (buffer_grow): Likewise. * common/filestuff.c (gdb_fopen_cloexec): Likewise. * common/format.c (parse_format_string): Likewise. * common/gdb_vecs.c (delim_string_to_char_ptr_vec_append): Likewise. * common/xml-utils.c (xml_escape_text): Likewise. * compile/compile-object-load.c (copy_sections): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * completer.c (filename_completer): Likewise. * corefile.c (read_memory_typed_address): Likewise. (write_memory_unsigned_integer): Likewise. (write_memory_signed_integer): Likewise. (complete_set_gnutarget): Likewise. * corelow.c (get_core_register_section): Likewise. * cp-name-parser.y (d_grab): Likewise. (allocate_info): Likewise. (cp_new_demangle_parse_info): Likewise. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Likewise. (cp_lookup_symbol_in_namespace): Likewise. (lookup_namespace_scope): Likewise. (find_symbol_in_baseclass): Likewise. (cp_lookup_nested_symbol): Likewise. (cp_lookup_transparent_type_loop): Likewise. * cp-support.c (copy_string_to_obstack): Likewise. (make_symbol_overload_list): Likewise. (make_symbol_overload_list_namespace): Likewise. (make_symbol_overload_list_adl_namespace): Likewise. (first_component_command): Likewise. * cp-valprint.c (cp_print_value): Likewise. * ctf.c (ctf_xfer_partial): Likewise. * d-exp.y (StringExp): Likewise. * d-namespace.c (d_lookup_symbol_in_module): Likewise. (lookup_module_scope): Likewise. (find_symbol_in_baseclass): Likewise. (d_lookup_nested_symbol): Likewise. * dbxread.c (find_stab_function_addr): Likewise. (read_dbx_symtab): Likewise. (dbx_end_psymtab): Likewise. (cp_set_block_scope): Likewise. * dcache.c (dcache_alloc): Likewise. * demangle.c (_initialize_demangler): Likewise. * dicos-tdep.c (dicos_load_module_p): Likewise. * dictionary.c (dict_create_hashed_expandable): Likewise. (dict_create_linear_expandable): Likewise. (expand_hashtable): Likewise. (add_symbol_linear_expandable): Likewise. * dwarf2-frame.c (add_cie): Likewise. (add_fde): Likewise. (dwarf2_build_frame_info): Likewise. * dwarf2expr.c (dwarf_expr_grow_stack): Likewise. (dwarf_expr_fetch_address): Likewise. (add_piece): Likewise. (execute_stack_op): Likewise. * dwarf2loc.c (chain_candidate): Likewise. (dwarf_entry_parameter_to_value): Likewise. (read_pieced_value): Likewise. (write_pieced_value): Likewise. * dwarf2read.c (dwarf2_read_section): Likewise. (add_type_unit): Likewise. (read_comp_units_from_section): Likewise. (fixup_go_packaging): Likewise. (dwarf2_compute_name): Likewise. (dwarf2_physname): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (read_call_site_scope): Likewise. (dwarf2_attach_fields_to_type): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (read_common_block): Likewise. (abbrev_table_read_table): Likewise. (guess_partial_die_structure_name): Likewise. (fixup_partial_die): Likewise. (add_file_name): Likewise. (dwarf2_const_value_data): Likewise. (dwarf2_const_value_attr): Likewise. (build_error_marker_type): Likewise. (guess_full_die_structure_name): Likewise. (anonymous_struct_prefix): Likewise. (typename_concat): Likewise. (dwarf2_canonicalize_name): Likewise. (dwarf2_name): Likewise. (write_constant_as_bytes): Likewise. (dwarf2_fetch_constant_bytes): Likewise. (copy_string): Likewise. (parse_macro_definition): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_rel_plt_read): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_gnu_ifunc_resolve_by_got): Likewise. (elf_read_minimal_symbols): Likewise. (elf_gnu_ifunc_record_cache): Likewise. * event-top.c (top_level_prompt): Likewise. (command_line_handler): Likewise. * exec.c (resize_section_table): Likewise. * expprint.c (print_subexp_standard): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * findcmd.c (parse_find_args): Likewise. * findvar.c (address_from_register): Likewise. * frame.c (get_prev_frame_always): Likewise. * gdb_bfd.c (gdb_bfd_ref): Likewise. (get_section_descriptor): Likewise. * gdb_obstack.c (obconcat): Likewise. (obstack_strdup): Likewise. * gdbtypes.c (lookup_function_type_with_arguments): Likewise. (create_set_type): Likewise. (lookup_unsigned_typename): Likewise. (lookup_signed_typename): Likewise. (resolve_dynamic_union): Likewise. (resolve_dynamic_struct): Likewise. (add_dyn_prop): Likewise. (copy_dynamic_prop_list): Likewise. (arch_flags_type): Likewise. (append_composite_type_field_raw): Likewise. * gdbtypes.h (INIT_FUNC_SPECIFIC): Likewise. * gnu-v3-abi.c (gnuv3_rtti_type): Likewise. * go-exp.y (string_exp): Likewise. * go-lang.c (go_demangle): Likewise. * guile/guile.c (compute_scheme_string): Likewise. * guile/scm-cmd.c (gdbscm_parse_command_name): Likewise. (gdbscm_canonicalize_command_name): Likewise. * guile/scm-ports.c (ioscm_init_stdio_buffers): Likewise. (ioscm_init_memory_port): Likewise. (ioscm_reinit_memory_port): Likewise. * guile/scm-utils.c (gdbscm_gc_xstrdup): Likewise. (gdbscm_gc_dup_argv): Likewise. * h8300-tdep.c (h8300_push_dummy_call): Likewise. * hppa-tdep.c (internalize_unwinds): Likewise. (read_unwind_info): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. (windows_core_xfer_shared_libraries): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. (i386_stap_parse_special_token_triplet): Likewise. (i386_stap_parse_special_token_three_arg_disp): Likewise. * i386obsd-tdep.c (i386obsd_sigtramp_p): Likewise. * inf-child.c (inf_child_fileio_readlink): Likewise. * inf-ptrace.c (inf_ptrace_fetch_register): Likewise. (inf_ptrace_store_register): Likewise. * infrun.c (follow_exec): Likewise. (displaced_step_prepare_throw): Likewise. (save_stop_context): Likewise. (save_infcall_suspend_state): Likewise. * jit.c (jit_read_descriptor): Likewise. (jit_read_code_entry): Likewise. (jit_symtab_line_mapping_add_impl): Likewise. (finalize_symtab): Likewise. (jit_unwind_reg_get_impl): Likewise. * jv-exp.y (QualifiedName): Likewise. * jv-lang.c (get_java_utf8_name): Likewise. (type_from_class): Likewise. (java_demangle_type_signature): Likewise. (java_class_name_from_physname): Likewise. * jv-typeprint.c (java_type_print_base): Likewise. * jv-valprint.c (java_value_print): Likewise. * language.c (add_language): Likewise. * linespec.c (add_sal_to_sals_basic): Likewise. (add_sal_to_sals): Likewise. (decode_objc): Likewise. (find_linespec_symbols): Likewise. * linux-fork.c (fork_save_infrun_state): Likewise. * linux-nat.c (linux_nat_detach): Likewise. (linux_nat_fileio_readlink): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (Do): Likewise. * linux-tdep.c (linux_core_info_proc_mappings): Likewise. (linux_collect_regset_section_cb): Likewise. (linux_get_siginfo_data): Likewise. * linux-thread-db.c (try_thread_db_load_from_pdir_1): Likewise. (try_thread_db_load_from_dir): Likewise. (thread_db_load_search): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_m16c_address_to_pointer): Likewise. (m32c_m16c_pointer_to_address): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_write): Likewise. * m68k-tdep.c (m68k_get_longjmp_target): Likewise. * machoread.c (macho_check_dsym): Likewise. * macroexp.c (resize_buffer): Likewise. (gather_arguments): Likewise. (maybe_expand): Likewise. * macrotab.c (new_macro_key): Likewise. (new_source_file): Likewise. (new_macro_definition): Likewise. * mdebugread.c (parse_symbol): Likewise. (parse_type): Likewise. (parse_partial_symbols): Likewise. (psymtab_to_symtab_1): Likewise. * mem-break.c (default_memory_insert_breakpoint): Likewise. * mi/mi-cmd-break.c (mi_argv_to_format): Likewise. * mi/mi-main.c (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_data_write_memory_bytes): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. (mi_parse): Likewise. * minidebug.c (lzma_open): Likewise. (lzma_pread): Likewise. * mips-tdep.c (mips_read_fp_register_single): Likewise. (mips_print_fp_register): Likewise. * mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise. * mipsread.c (read_alphacoff_dynamic_symtab): Likewise. * mt-tdep.c (mt_register_name): Likewise. (mt_registers_info): Likewise. (mt_push_dummy_call): Likewise. * namespace.c (add_using_directive): Likewise. * nat/linux-btrace.c (perf_event_read): Likewise. (linux_enable_bts): Likewise. * nat/linux-osdata.c (linux_common_core_of_thread): Likewise. * nat/linux-ptrace.c (linux_ptrace_test_ret_to_nx): Likewise. * nto-tdep.c (nto_find_and_open_solib): Likewise. (nto_parse_redirection): Likewise. * objc-lang.c (objc_demangle): Likewise. (find_methods): Likewise. * objfiles.c (get_objfile_bfd_data): Likewise. (set_objfile_main_name): Likewise. (allocate_objfile): Likewise. (objfile_relocate): Likewise. (update_section_map): Likewise. * osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Likewise. * p-exp.y (exp): Likewise. (yylex): Likewise. * p-valprint.c (pascal_object_print_value): Likewise. * parse.c (initialize_expout): Likewise. (mark_completion_tag): Likewise. (copy_name): Likewise. (parse_float): Likewise. (type_stack_reserve): Likewise. * ppc-linux-tdep.c (ppc_stap_parse_special_token): Likewise. (ppu2spu_prev_register): Likewise. * ppc-ravenscar-thread.c (supply_register_at_address): Likewise. * printcmd.c (printf_wide_c_string): Likewise. (printf_pointer): Likewise. * probe.c (parse_probes): Likewise. * python/py-cmd.c (gdbpy_parse_command_name): Likewise. (cmdpy_init): Likewise. * python/py-gdb-readline.c (gdbpy_readline_wrapper): Likewise. * python/py-symtab.c (set_sal): Likewise. * python/py-unwind.c (pyuw_sniffer): Likewise. * python/python.c (python_interactive_command): Likewise. (compute_python_string): Likewise. * ravenscar-thread.c (get_running_thread_id): Likewise. * record-full.c (record_full_exec_insn): Likewise. (record_full_core_open_1): Likewise. * regcache.c (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. * remote-fileio.c (remote_fileio_func_open): Likewise. (remote_fileio_func_rename): Likewise. (remote_fileio_func_unlink): Likewise. (remote_fileio_func_stat): Likewise. (remote_fileio_func_system): Likewise. * remote-mips.c (mips_xfer_memory): Likewise. (mips_load_srec): Likewise. (pmon_end_download): Likewise. * remote.c (new_remote_state): Likewise. (map_regcache_remote_table): Likewise. (remote_register_number_and_offset): Likewise. (init_remote_state): Likewise. (get_memory_packet_size): Likewise. (remote_pass_signals): Likewise. (remote_program_signals): Likewise. (remote_start_remote): Likewise. (remote_check_symbols): Likewise. (remote_query_supported): Likewise. (extended_remote_attach): Likewise. (process_g_packet): Likewise. (store_registers_using_G): Likewise. (putpkt_binary): Likewise. (read_frame): Likewise. (compare_sections_command): Likewise. (remote_hostio_pread): Likewise. (remote_hostio_readlink): Likewise. (remote_file_put): Likewise. (remote_file_get): Likewise. (remote_pid_to_exec_file): Likewise. (_initialize_remote): Likewise. * rs6000-aix-tdep.c (rs6000_aix_ld_info_to_xml): Likewise. (rs6000_aix_core_xfer_shared_libraries_aix): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. (bfd_uses_spe_extensions): Likewise. * s390-linux-tdep.c (s390_displaced_step_copy_insn): Likewise. * score-tdep.c (score7_malloc_and_get_memblock): Likewise. * solib-dsbt.c (decode_loadmap): Likewise. (fetch_loadmap): Likewise. (scan_dyntag): Likewise. (enable_break): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (fetch_loadmap): Likewise. (enable_break2): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_relocate_main_executable): Likewise. (spu_bfd_open): Likewise. * solib-svr4.c (lm_info_read): Likewise. (read_program_header): Likewise. (find_program_interpreter): Likewise. (scan_dyntag): Likewise. (elf_locate_base): Likewise. (open_symbol_file_object): Likewise. (read_program_headers_from_bfd): Likewise. (svr4_relocate_main_executable): Likewise. * solib-target.c (solib_target_relocate_section_addresses): Likewise. * solib.c (solib_find_1): Likewise. (exec_file_find): Likewise. (solib_find): Likewise. * source.c (openp): Likewise. (print_source_lines_base): Likewise. (forward_search_command): Likewise. * sparc-ravenscar-thread.c (supply_register_at_address): Likewise. * spu-tdep.c (spu2ppu_prev_register): Likewise. (spu_get_overlay_table): Likewise. * stabsread.c (patch_block_stabs): Likewise. (define_symbol): Likewise. (again:): Likewise. (read_member_functions): Likewise. (read_one_struct_field): Likewise. (read_enum_type): Likewise. (common_block_start): Likewise. * stack.c (read_frame_arg): Likewise. (backtrace_command): Likewise. * stap-probe.c (stap_parse_register_operand): Likewise. * symfile.c (syms_from_objfile_1): Likewise. (find_separate_debug_file): Likewise. (load_command): Likewise. (load_progress): Likewise. (load_section_callback): Likewise. (reread_symbols): Likewise. (add_filename_language): Likewise. (allocate_compunit_symtab): Likewise. (read_target_long_array): Likewise. (simple_read_overlay_table): Likewise. * symtab.c (symbol_set_names): Likewise. (resize_symbol_cache): Likewise. (rbreak_command): Likewise. (completion_list_add_name): Likewise. (completion_list_objc_symbol): Likewise. (add_filename_to_list): Likewise. * target-descriptions.c (maint_print_c_tdesc_cmd): Likewise. * target-memory.c (target_write_memory_blocks): Likewise. * target.c (target_read_string): Likewise. (read_whatever_is_readable): Likewise. (target_read_alloc_1): Likewise. (simple_search_memory): Likewise. (target_fileio_read_alloc_1): Likewise. * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. * top.c (command_line_input): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (tracefile_fetch_registers): Likewise. * tracepoint.c (add_memrange): Likewise. (init_collection_list): Likewise. (add_aexpr): Likewise. (trace_dump_actions): Likewise. (parse_trace_status): Likewise. (parse_tracepoint_definition): Likewise. (parse_tsv_definition): Likewise. (parse_static_tracepoint_marker_definition): Likewise. * tui/tui-file.c (tui_sfileopen): Likewise. (tui_file_adjust_strbuf): Likewise. * tui/tui-io.c (tui_expand_tabs): Likewise. * tui/tui-source.c (tui_set_source_content): Likewise. * typeprint.c (find_global_typedef): Likewise. * ui-file.c (do_ui_file_xstrdup): Likewise. (ui_file_obsavestring): Likewise. (mem_file_write): Likewise. * utils.c (make_hex_string): Likewise. (get_regcomp_error): Likewise. (puts_filtered_tabular): Likewise. (gdb_realpath_keepfile): Likewise. (ldirname): Likewise. (gdb_bfd_errmsg): Likewise. (substitute_path_component): Likewise. * valops.c (search_struct_method): Likewise. (find_oload_champ_namespace_loop): Likewise. * valprint.c (print_decimal_chars): Likewise. (read_string): Likewise. (generic_emit_char): Likewise. * varobj.c (varobj_delete): Likewise. (varobj_value_get_print_value): Likewise. * vaxobsd-tdep.c (vaxobsd_sigtramp_sniffer): Likewise. * windows-tdep.c (display_one_tib): Likewise. * xcoffread.c (read_xcoff_symtab): Likewise. (process_xcoff_symbol): Likewise. (swap_sym): Likewise. (scan_xcoff_symtab): Likewise. (xcoff_initial_scan): Likewise. * xml-support.c (gdb_xml_end_element): Likewise. (xml_process_xincludes): Likewise. (xml_fetch_content_from_file): Likewise. * xml-syscall.c (xml_list_of_syscalls): Likewise. * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Add cast to allocation result assignment. (gdb_unparse_agent_expr): Likewise. * hostio.c (require_data): Likewise. (handle_pread): Likewise. * linux-low.c (disable_regset): Likewise. (fetch_register): Likewise. (store_register): Likewise. (get_dynamic): Likewise. (linux_qxfer_libraries_svr4): Likewise. * mem-break.c (delete_fast_tracepoint_jump): Likewise. (set_fast_tracepoint_jump): Likewise. (uninsert_fast_tracepoint_jumps_at): Likewise. (reinsert_fast_tracepoint_jumps_at): Likewise. (validate_inserted_breakpoint): Likewise. (clone_agent_expr): Likewise. * regcache.c (init_register_cache): Likewise. * remote-utils.c (putpkt_binary_1): Likewise. (decode_M_packet): Likewise. (decode_X_packet): Likewise. (look_up_one_symbol): Likewise. (relocate_instruction): Likewise. (monitor_output): Likewise. * server.c (handle_search_memory): Likewise. (handle_qxfer_exec_file): Likewise. (handle_qxfer_libraries): Likewise. (handle_qxfer): Likewise. (handle_query): Likewise. (handle_v_cont): Likewise. (handle_v_run): Likewise. (captured_main): Likewise. * target.c (write_inferior_memory): Likewise. * thread-db.c (try_thread_db_load_from_dir): Likewise. * tracepoint.c (init_trace_buffer): Likewise. (add_tracepoint_action): Likewise. (add_traceframe): Likewise. (add_traceframe_block): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtdv): Likewise. (cmd_qtstatus): Likewise. (response_source): Likewise. (response_tsv): Likewise. (cmd_qtnotes): Likewise. (gdb_collect): Likewise. (initialize_tracepoint): Likewise.
2015-09-25 20:08:06 +02:00
target_name = (char *) alloca (target_len + 1);
memcpy (target_name, name + 2, target_len);
target_name[target_len] = '\0';
sec = find_pc_section (pc);
objfile = (sec == NULL) ? NULL : sec->objfile;
minsym = lookup_minimal_symbol (target_name, NULL, objfile);
use bound_minsym as result for lookup_minimal_symbol et al This patch changes a few minimal symbol lookup functions to return a bound_minimal_symbol rather than a pointer to the minsym. This change helps prepare gdb for computing a minimal symbol's address at the point of use. Note that this changes even those functions that ostensibly search a single objfile. That was necessary because, in fact, those functions can search an objfile and its separate debug objfiles; and it is important for the caller to know in which objfile the minimal symbol was actually found. The bulk of this patch is mechanical. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_update_initial_language): Update. (ada_main_name, ada_has_this_exception_support): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * breakpoint.c (struct breakpoint_objfile_data) <overlay_msym, longjmp_msym, terminate_msym, exception_msym>: Change type to bound_minimal_symbol. (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-exp.y (classify_name): Update. * coffread.c (coff_symfile_read): Update. * common/agent.c (agent_look_up_symbols): Update. * d-lang.c (d_main_name): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dec-thread.c (enable_dec_thread): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * elfread.c (elf_gnu_ifunc_resolve_by_got): Update. * eval.c (evaluate_subexp_standard): Update. * findvar.c (struct minsym_lookup_data) <result>: Change type to bound_minimal_symbol. <objfile>: Remove. (minsym_lookup_iterator_cb, default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * gcore.c (call_target_sbrk): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * go-lang.c (go_main_name): Update. * hppa-hpux-tdep.c (hppa_hpux_skip_trampoline_code) (hppa_hpux_find_import_stub_for_addr): Update. * hppa-tdep.c (hppa_extract_17, hppa_lookup_stub_minimal_symbol): Update. Change return type. * hppa-tdep.h (hppa_lookup_stub_minimal_symbol): Change return type. * jit.c (jit_breakpoint_re_set_internal): Update. * linux-fork.c (inferior_call_waitpid, checkpoint_command): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * minsyms.c (lookup_minimal_symbol_internal): Rename to lookup_minimal_symbol. Change return type. (lookup_minimal_symbol): Remove. (lookup_bound_minimal_symbol): Update. (lookup_minimal_symbol_text): Change return type. (lookup_minimal_symbol_solib_trampoline): Change return type. * minsyms.h (lookup_minimal_symbol, lookup_minimal_symbol_text) (lookup_minimal_symbol_solib_trampoline): Change return type. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * objc-lang.c (lookup_objc_class, lookup_child_selector) (value_nsstring, find_imps): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-lang.c (pascal_main_name): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * proc-service.c (ps_pglobal_lookup): Update. * ravenscar-thread.c (get_running_thread_msymbol): Change return type. (has_ravenscar_runtime, get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sol-thread.c (ps_pglobal_lookup): Update. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, frv_relocate_section_addresses): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (som_solib_desire_dynamic_linker_symbols, link_map_start): Update. * solib-spu.c (spu_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol): Update. * symfile.c (simple_read_overlay_table): Update. * symtab.c (find_pc_sect_line): Update. * tracepoint.c (scope_info): Update. * tui-disasm.c (tui_get_begin_asm_address): Update. * value.c (value_static_field): Update.
2013-10-15 03:53:29 +02:00
if (minsym.minsym != NULL)
start change to progspace independence This patch starts changing minimal symbols to be independent of the program space. Specifically, it adds a new objfile parameter to MSYMBOL_VALUE_ADDRESS and changes all the code to use it. This is needed so we can change gdb to apply the section offset when a minsym's address is computed, as opposed to baking the offsets into the symbol itself. A few spots still need the unrelocated address. For these, we introduce MSYMBOL_VALUE_RAW_ADDRESS. As a convenience, we also add the new macro BMSYMBOL_VALUE_ADDRESS, which computes the address of a bound minimal symbol. This just does the obvious thing with the fields. Note that this change does not actually enable program space independence. That requires more changes to gdb. However, to ensure that these changes compile properly, this patch does add the needed section lookup code to MSYMBOL_VALUE_ADDRESS -- it just ensures it has no effect at runtime by multiplying the offset by 0. 2014-02-26 Tom Tromey <tromey@redhat.com> * ada-lang.c (ada_main_name): Update. (ada_add_standard_exceptions): Update. * ada-tasks.c (ada_tasks_inferior_data_sniffer): Update. * aix-thread.c (pdc_symbol_addrs, pd_enable): Update. * arm-tdep.c (skip_prologue_function, arm_skip_stub): Update. * auxv.c (ld_so_xfer_auxv): Update. * avr-tdep.c (avr_scan_prologue): Update. * ax-gdb.c (gen_var_ref): Update. * blockframe.c (get_pc_function_start) (find_pc_partial_function_gnu_ifunc): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * bsd-uthread.c (bsd_uthread_lookup_address): Update. * c-valprint.c (c_val_print): Update. * coff-pe-read.c (add_pe_forwarded_sym): Update. * common/agent.c (agent_look_up_symbols): Update. * dbxread.c (find_stab_function_addr, end_psymtab): Update. * dwarf2loc.c (call_site_to_target_addr): Update. * dwarf2read.c (dw2_find_pc_sect_symtab): Update. * elfread.c (elf_gnu_ifunc_record_cache) (elf_gnu_ifunc_resolve_by_got): Update. * findvar.c (default_read_var_value): Update. * frame.c (inside_main_func): Update. * frv-tdep.c (frv_frame_this_id): Update. * glibc-tdep.c (glibc_skip_solib_resolver): Update. * gnu-v3-abi.c (gnuv3_get_typeid, gnuv3_skip_trampoline): Update. * hppa-hpux-tdep.c (hppa64_hpux_search_dummy_call_sequence) (hppa_hpux_find_dummy_bpaddr): Update. * hppa-tdep.c (hppa_symbol_address): Update. * infcmd.c (until_next_command): Update. * jit.c (jit_read_descriptor, jit_breakpoint_re_set_internal): Update. * linespec.c (minsym_found, add_minsym): Update. * linux-nat.c (get_signo): Update. * linux-thread-db.c (inferior_has_bug): Update. * m32c-tdep.c (m32c_return_value) (m32c_m16c_address_to_pointer): Update. * m32r-tdep.c (m32r_frame_this_id): Update. * m68hc11-tdep.c (m68hc11_get_register_info): Update. * machoread.c (macho_resolve_oso_sym_with_minsym): Update. * maint.c (maintenance_translate_address): Update. * minsyms.c (lookup_minimal_symbol_by_pc_name): Update. (frob_address): New function. (lookup_minimal_symbol_by_pc_section_1): Use raw addresses, frob_address. Rename parameter to "pc_in". (compare_minimal_symbols, compact_minimal_symbols): Use raw addresses. (find_solib_trampoline_target, minimal_symbol_upper_bound): Update. * mips-linux-tdep.c (mips_linux_skip_resolver): Update. * mips-tdep.c (mips_skip_pic_trampoline_code): Update. * objc-lang.c (find_objc_msgsend): Update. * objfiles.c (objfile_relocate1): Update. * obsd-tdep.c (obsd_skip_solib_resolver): Update. * p-valprint.c (pascal_val_print): Update. * parse.c (write_exp_msymbol): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_lookup) (ppc_elfv2_skip_entrypoint): Update. * ppc-sysv-tdep.c (convert_code_addr_to_desc_addr): Update. * printcmd.c (build_address_symbolic, msym_info) (address_info): Update. * proc-service.c (ps_pglobal_lookup): Update. * psymtab.c (find_pc_sect_psymtab_closer) (find_pc_sect_psymtab, find_pc_sect_symtab_from_partial): Change msymbol parameter to bound_minimal_symbol. * ravenscar-thread.c (get_running_thread_id): Update. * remote.c (remote_check_symbols): Update. * sh64-tdep.c (sh64_elf_make_msymbol_special): Use raw address. * sol2-tdep.c (sol2_skip_solib_resolver): Update. * solib-dsbt.c (lm_base): Update. * solib-frv.c (lm_base, main_got): Update. * solib-irix.c (locate_base): Update. * solib-som.c (som_solib_create_inferior_hook) (link_map_start): Update. * solib-spu.c (spu_enable_break, ocl_enable_break): Update. * solib-svr4.c (elf_locate_base, enable_break): Update. * spu-tdep.c (spu_get_overlay_table, spu_catch_start) (flush_ea_cache): Update. * stabsread.c (define_symbol, scan_file_globals): Update. * stack.c (find_frame_funname): Update. * symfile-debug.c (debug_qf_expand_symtabs_matching) (debug_qf_find_pc_sect_symtab): Update. * symfile.c (simple_read_overlay_table) (simple_overlay_update): Update. * symfile.h (struct quick_symbol_functions) <find_pc_sect_symtab>: Change type of msymbol to bound_minimal_symbol. * symmisc.c (dump_msymbols): Update. * symtab.c (find_pc_sect_symtab_via_partial) (find_pc_sect_psymtab, find_pc_sect_line, skip_prologue_sal) (search_symbols, print_msymbol_info): Update. * symtab.h (MSYMBOL_VALUE_RAW_ADDRESS): New macro. (MSYMBOL_VALUE_ADDRESS): Redefine. (BMSYMBOL_VALUE_ADDRESS): New macro. * tracepoint.c (scope_info): Update. * tui/tui-disasm.c (tui_find_disassembly_address) (tui_get_begin_asm_address): Update. * valops.c (find_function_in_inferior): Update. * value.c (value_static_field, value_fn_field): Update.
2013-08-15 16:46:35 +02:00
return BMSYMBOL_VALUE_ADDRESS (minsym);
else
return 0;
}
[gdb][Arm]: gdb cannot step across CMSE secure entry function code. GDB is not able to execute "step" command on function calls of Armv8-M cmse secure entry functions. Everytime GNU linker come across definition of any cmse secure entry function in object file(s), it creates two new instructions secure gateway (sg) and original branch destination (b.w), place those two instructions in ".gnu.sgstubs" section of executable. Any function calls to these cmse secure entry functions is re-directed through secure gateway (sg) present in ".gnu.sgstubs" section. Example: Following is a function call to cmse secure entry function "foo": ... bl xxxx <foo> --->(a) ... <foo> xxxx: push {r7, lr} GNU linker on finding out "foo" is a cmse secure entry function, created sg and b.w instructions and place them in ".gnu.sgstubs" section (marked by c). The "bl" instruction (marked by a) which is a call to cmse secure entry function is modified by GNU linker (as marked by b) and call flow is re-directly through secure gateway (sg) in ".gnu.sgstubs" section. ... bl yyyy <foo> ---> (b) ... section .gnu.sgstubs: ---> (c) yyyy <foo> yyyy: sg // secure gateway b.w xxxx <__acle_se_foo> // original_branch_dest ... 0000xxxx <__acle_se_foo> xxxx: push {r7, lr} ---> (d) On invoking GDB, when the control is at "b" and we pass "step" command, the pc returns "yyyy" (sg address) which is a trampoline and which does not exist in source code. So GDB jumps to next line without jumping to "__acle_se_foo" (marked by d). The above details are published on the Arm website [1], please refer to section 5.4 (Entry functions) and section 3.4.4 (C level development flow of secure code). [1] https://developer.arm.com/architectures/cpu-architecture/m-profile/docs/ecm0359818/latest/armv8-m-security-extensions-requirements-on-development-tools-engineering-specification This patch fixes above problem by returning target pc "xxxx" to GDB on executing "step" command at "b", so that the control jumps to "__acle_se_foo" (marked by d). gdb/ChangeLog: * arm-tdep.c (arm_skip_cmse_entry): New function. (arm_is_sgstubs_section): New function. (arm_skip_stub): Add call to arm_skip_cmse_entry function. gdb/testsuite/ChangeLog: * gdb.arch/arm-cmse-sgstubs.c: New test. * gdb.arch/arm-cmse-sgstubs.exp: New file.
2019-07-23 12:21:11 +02:00
struct obj_section *section = find_pc_section (pc);
/* Check whether SECTION points to the ".gnu.sgstubs" section. */
if (arm_is_sgstubs_section (section))
return arm_skip_cmse_entry (pc, name, section->objfile);
1999-07-07 22:19:36 +02:00
return 0; /* not a stub */
}
static void
arm_update_current_architecture (void)
{
struct gdbarch_info info;
/* If the current architecture is not ARM, we have nothing to do. */
if (gdbarch_bfd_arch_info (target_gdbarch ())->arch != bfd_arch_arm)
return;
/* Update the architecture. */
gdbarch_info_init (&info);
if (!gdbarch_update_p (info))
internal_error (__FILE__, __LINE__, _("could not update architecture"));
}
static void
Constify add_setshow_* This constifies the add_setshow_* family of functions, and then fixes up the fallout. The bulk of this patch was written by script. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * ada-lang.c (catch_ada_exception_command): Constify. (catch_assert_command): Constify. * break-catch-throw.c (catch_catch_command, catch_throw_command) (catch_rethrow_command): Constify. (catch_exception_command_1): Constify. * breakpoint.h (add_catch_command): Constify. * break-catch-syscall.c (catch_syscall_command_1): Constify. (catch_syscall_split_args): Constify. * break-catch-sig.c (catch_signal_command): Constify. (catch_signal_split_args): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Use cmd_const_sfunc_ftype. * cli/cli-decode.c (add_setshow_cmd_full): Constify. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, struct cmd_list_element) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd): Constify. (set_cmd_sfunc): Constify. (empty_sfunc): Constify. * command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Constify. (set_cmd_sfunc): Constify. (cmd_sfunc_ftype): Remove. * compile/compile.c (set_compile_args): Constify. * infrun.c (set_disable_randomization): Constify. * infcmd.c (set_args_command, set_cwd_command): Constify. * breakpoint.c (set_condition_evaluation_mode): Constify. (add_catch_command): Constify. (catch_fork_command_1, catch_exec_command_1) (catch_load_command_1, catch_unload_command_1): Constify. (catch_load_or_unload): Constify. * guile/scm-param.c (pascm_set_func): Constify. (add_setshow_generic): Constify. * python/py-param.c (get_set_value): Constify. * top.h (set_verbose): Constify. * tui/tui-win.c (tui_set_var_cmd): Constify. * mi/mi-main.c (set_mi_async_command): Constify. * cli/cli-logging.c (set_logging_overwrite) (set_logging_redirect): Constify. * value.c (set_max_value_size): Constify. * valprint.c (set_input_radix, set_output_radix): Constify. * utils.c (set_width_command, set_height_command): Constify. * typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify. * tracepoint.c (set_disconnected_tracing) (set_circular_trace_buffer, set_trace_buffer_size) (set_trace_user, set_trace_notes, set_trace_stop_notes): Constify. * top.c (set_history_size_command, set_verbose, set_editing) (set_gdb_datadir, set_history_filename): Constify. * target.c (set_targetdebug, maint_set_target_async_command) (maint_set_target_non_stop_command, set_target_permissions) (set_write_memory_permission): Constify. (open_target): Constify. * target-descriptions.c (set_tdesc_filename_cmd): Constify. * target-dcache.c (set_stack_cache, set_code_cache): Constify. * symtab.c (set_symbol_cache_size_handler): Constify. * symfile.c (set_ext_lang_command): Constify. * symfile-debug.c (set_debug_symfile): Constify. * source.c (set_directories_command): Constify. * solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify. * serial.c (set_parity): Constify. * rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify. * remote.c (set_remote_exec_file, set_remotebreak) (set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify. * record.c (set_record_insn_history_size) (set_record_call_history_size): Constify. * record-full.c (set_record_full_insn_max_num): Constify. * proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify. * osabi.c (set_osabi): Constify. * mips-tdep.c (set_mips64_transfers_32bit_regs) (reinit_frame_cache_sfunc, mips_abi_update): Constify. * maint.c (maintenance_set_profile_cmd): Constify. * linux-thread-db.c (set_libthread_db_search_path): Constify. * language.c (set_language_command, set_range_command) (set_case_command): Constify. * infrun.c (set_non_stop, set_observer_mode) (set_stop_on_solib_events, set_schedlock_func) (set_exec_direction_func): Constify. * infcmd.c (set_inferior_tty_command): Constify. * disasm.c (set_disassembler_options_sfunc): Constify. * demangle.c (set_demangling_command): Constify. * dcache.c (set_dcache_size, set_dcache_line_size): Constify. * cris-tdep.c (set_cris_version, set_cris_mode) (set_cris_dwarf2_cfi): Constify. * corefile.c (set_gnutarget_command): Constify. * charset.c (set_host_charset_sfunc, set_target_charset_sfunc) (set_target_wide_charset_sfunc): Constify. * breakpoint.c (update_dprintf_commands): Constify. * auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify. * arm-tdep.c (set_fp_model_sfunc, arm_set_abi) (set_disassembly_style_sfunc): Constify. * arch-utils.c (set_endian, set_architecture): Constify. * alpha-tdep.c (reinit_frame_cache_sfunc): Constify. * agent.c (set_can_use_agent): Constify.
2017-10-14 17:07:00 +02:00
set_fp_model_sfunc (const char *args, int from_tty,
struct cmd_list_element *c)
{
int fp_model;
for (fp_model = ARM_FLOAT_AUTO; fp_model != ARM_FLOAT_LAST; fp_model++)
if (strcmp (current_fp_model, fp_model_strings[fp_model]) == 0)
{
Add casts for legitimate integer to enum conversions This patch is mostly extracted from Pedro's C++ branch. It adds explicit casts from integer to enum types, where it is really the intention to do so. This could be because we are ... * iterating on enum values (we need to iterate on an equivalent integer) * converting from a value read from bytes (dwarf attribute, agent expression opcode) to the equivalent enum * reading the equivalent integer value from another language (Python/Guile) An exception to that is the casts in regcache.c. It seems to me like struct regcache's register_status field could be a pointer to an array of enum register_status. Doing so would waste a bit of memory (4 bytes used by the enum vs 1 byte used by the current signed char, for each register). If we switch to C++11 one day, we can define the underlying type of an enum type, so we could have the best of both worlds. gdb/ChangeLog: * arm-tdep.c (set_fp_model_sfunc): Add cast from integer to enum. (arm_set_abi): Likewise. * ax-general.c (ax_print): Likewise. * c-exp.y (exp : string_exp): Likewise. * compile/compile-loc2c.c (compute_stack_depth_worker): Likewise. (do_compile_dwarf_expr_to_c): Likewise. * cp-name-parser.y (demangler_special : DEMANGLER_SPECIAL start): Likewise. * dwarf2expr.c (execute_stack_op): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. (disassemble_dwarf_expression): Likewise. * dwarf2read.c (dwarf2_add_member_fn): Likewise. (read_array_order): Likewise. (abbrev_table_read_table): Likewise. (read_attribute_value): Likewise. (skip_unknown_opcode): Likewise. (dwarf_decode_macro_bytes): Likewise. (dwarf_decode_macros): Likewise. * eval.c (value_f90_subarray): Likewise. * guile/scm-param.c (gdbscm_make_parameter): Likewise. * i386-linux-tdep.c (i386_canonicalize_syscall): Likewise. * infrun.c (handle_command): Likewise. * memory-map.c (memory_map_start_memory): Likewise. * osabi.c (set_osabi): Likewise. * parse.c (operator_length_standard): Likewise. * ppc-linux-tdep.c (ppc_canonicalize_syscall): Likewise, and use single return point. * python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise. * python/py-symbol.c (gdbpy_lookup_symbol): Likewise. (gdbpy_lookup_global_symbol): Likewise. * record-full.c (record_full_restore): Likewise. * regcache.c (regcache_register_status): Likewise. (regcache_raw_read): Likewise. (regcache_cooked_read): Likewise. * rs6000-tdep.c (powerpc_set_vector_abi): Likewise. * symtab.c (initialize_ordinary_address_classes): Likewise. * target-debug.h (target_debug_print_signals): Likewise. * utils.c (do_restore_current_language): Likewise.
2015-08-06 23:21:41 +02:00
arm_fp_model = (enum arm_float_model) fp_model;
break;
}
if (fp_model == ARM_FLOAT_LAST)
internal_error (__FILE__, __LINE__, _("Invalid fp model accepted: %s."),
current_fp_model);
arm_update_current_architecture ();
}
static void
2005-02-16 Andrew Cagney <cagney@gnu.org> Merge setshow print and show parameters. * command.h (show_value_ftype): Define. (deprecated_show_value_hack): Declare. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_uinteger_cmd) (add_setshow_zinteger_cmd): Change type of show_func to show_value_ftype. * cli/cli-decode.h (struct cmd_list_element): Replace fprint_setshow with show_value_func. * cli/cli-decode.c (add_setshow_cmd_full): Update show_func parameter. Set show_value_func. Do not set cmd_sfunc. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_uinteger_cmd) (add_setshow_zinteger_cmd): Update. * complaints.c (complaints_show_value): Replace fprint_setshow_complaints. (_initialize_complaints): Update. * mips-tdep.c (show_mask_address): Update. * arm-tdep.c (show_fp_model): Update. * cli/cli-setshow.c (do_setshow_command): Call show_value_func instead of fprint_setshow. Use deprecated_show_value_hack. (deprecated_show_value_hack): New function. * remote.c (add_packet_config_cmd, show_remote_cmd): (show_remote_protocol_P_packet_cmd) (show_remote_protocol_P_packet_cmd) (show_remote_protocol_Z_access_wp_packet_cmd) (show_remote_protocol_Z_hardware_bp_packet_cmd) (show_remote_protocol_Z_packet_cmd) (show_remote_protocol_Z_read_wp_packet_cmd) (show_remote_protocol_Z_software_bp_packet_cmd) (show_remote_protocol_Z_write_wp_packet_cmd) (show_remote_protocol_binary_download_cmd) (show_remote_protocol_p_packet_cmd) (show_remote_protocol_qPart_auxv_packet_cmd) (show_remote_protocol_qSymbol_packet_cmd) (show_remote_protocol_vcont_packet_cmd): Update.
2005-02-16 18:20:59 +01:00
show_fp_model (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
if (arm_fp_model == ARM_FLOAT_AUTO
&& gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
fprintf_filtered (file, _("\
The current ARM floating point model is \"auto\" (currently \"%s\").\n"),
fp_model_strings[tdep->fp_model]);
else
fprintf_filtered (file, _("\
The current ARM floating point model is \"%s\".\n"),
fp_model_strings[arm_fp_model]);
}
static void
Constify add_setshow_* This constifies the add_setshow_* family of functions, and then fixes up the fallout. The bulk of this patch was written by script. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * ada-lang.c (catch_ada_exception_command): Constify. (catch_assert_command): Constify. * break-catch-throw.c (catch_catch_command, catch_throw_command) (catch_rethrow_command): Constify. (catch_exception_command_1): Constify. * breakpoint.h (add_catch_command): Constify. * break-catch-syscall.c (catch_syscall_command_1): Constify. (catch_syscall_split_args): Constify. * break-catch-sig.c (catch_signal_command): Constify. (catch_signal_split_args): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Use cmd_const_sfunc_ftype. * cli/cli-decode.c (add_setshow_cmd_full): Constify. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, struct cmd_list_element) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd): Constify. (set_cmd_sfunc): Constify. (empty_sfunc): Constify. * command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Constify. (set_cmd_sfunc): Constify. (cmd_sfunc_ftype): Remove. * compile/compile.c (set_compile_args): Constify. * infrun.c (set_disable_randomization): Constify. * infcmd.c (set_args_command, set_cwd_command): Constify. * breakpoint.c (set_condition_evaluation_mode): Constify. (add_catch_command): Constify. (catch_fork_command_1, catch_exec_command_1) (catch_load_command_1, catch_unload_command_1): Constify. (catch_load_or_unload): Constify. * guile/scm-param.c (pascm_set_func): Constify. (add_setshow_generic): Constify. * python/py-param.c (get_set_value): Constify. * top.h (set_verbose): Constify. * tui/tui-win.c (tui_set_var_cmd): Constify. * mi/mi-main.c (set_mi_async_command): Constify. * cli/cli-logging.c (set_logging_overwrite) (set_logging_redirect): Constify. * value.c (set_max_value_size): Constify. * valprint.c (set_input_radix, set_output_radix): Constify. * utils.c (set_width_command, set_height_command): Constify. * typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify. * tracepoint.c (set_disconnected_tracing) (set_circular_trace_buffer, set_trace_buffer_size) (set_trace_user, set_trace_notes, set_trace_stop_notes): Constify. * top.c (set_history_size_command, set_verbose, set_editing) (set_gdb_datadir, set_history_filename): Constify. * target.c (set_targetdebug, maint_set_target_async_command) (maint_set_target_non_stop_command, set_target_permissions) (set_write_memory_permission): Constify. (open_target): Constify. * target-descriptions.c (set_tdesc_filename_cmd): Constify. * target-dcache.c (set_stack_cache, set_code_cache): Constify. * symtab.c (set_symbol_cache_size_handler): Constify. * symfile.c (set_ext_lang_command): Constify. * symfile-debug.c (set_debug_symfile): Constify. * source.c (set_directories_command): Constify. * solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify. * serial.c (set_parity): Constify. * rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify. * remote.c (set_remote_exec_file, set_remotebreak) (set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify. * record.c (set_record_insn_history_size) (set_record_call_history_size): Constify. * record-full.c (set_record_full_insn_max_num): Constify. * proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify. * osabi.c (set_osabi): Constify. * mips-tdep.c (set_mips64_transfers_32bit_regs) (reinit_frame_cache_sfunc, mips_abi_update): Constify. * maint.c (maintenance_set_profile_cmd): Constify. * linux-thread-db.c (set_libthread_db_search_path): Constify. * language.c (set_language_command, set_range_command) (set_case_command): Constify. * infrun.c (set_non_stop, set_observer_mode) (set_stop_on_solib_events, set_schedlock_func) (set_exec_direction_func): Constify. * infcmd.c (set_inferior_tty_command): Constify. * disasm.c (set_disassembler_options_sfunc): Constify. * demangle.c (set_demangling_command): Constify. * dcache.c (set_dcache_size, set_dcache_line_size): Constify. * cris-tdep.c (set_cris_version, set_cris_mode) (set_cris_dwarf2_cfi): Constify. * corefile.c (set_gnutarget_command): Constify. * charset.c (set_host_charset_sfunc, set_target_charset_sfunc) (set_target_wide_charset_sfunc): Constify. * breakpoint.c (update_dprintf_commands): Constify. * auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify. * arm-tdep.c (set_fp_model_sfunc, arm_set_abi) (set_disassembly_style_sfunc): Constify. * arch-utils.c (set_endian, set_architecture): Constify. * alpha-tdep.c (reinit_frame_cache_sfunc): Constify. * agent.c (set_can_use_agent): Constify.
2017-10-14 17:07:00 +02:00
arm_set_abi (const char *args, int from_tty,
struct cmd_list_element *c)
{
int arm_abi;
for (arm_abi = ARM_ABI_AUTO; arm_abi != ARM_ABI_LAST; arm_abi++)
if (strcmp (arm_abi_string, arm_abi_strings[arm_abi]) == 0)
{
Add casts for legitimate integer to enum conversions This patch is mostly extracted from Pedro's C++ branch. It adds explicit casts from integer to enum types, where it is really the intention to do so. This could be because we are ... * iterating on enum values (we need to iterate on an equivalent integer) * converting from a value read from bytes (dwarf attribute, agent expression opcode) to the equivalent enum * reading the equivalent integer value from another language (Python/Guile) An exception to that is the casts in regcache.c. It seems to me like struct regcache's register_status field could be a pointer to an array of enum register_status. Doing so would waste a bit of memory (4 bytes used by the enum vs 1 byte used by the current signed char, for each register). If we switch to C++11 one day, we can define the underlying type of an enum type, so we could have the best of both worlds. gdb/ChangeLog: * arm-tdep.c (set_fp_model_sfunc): Add cast from integer to enum. (arm_set_abi): Likewise. * ax-general.c (ax_print): Likewise. * c-exp.y (exp : string_exp): Likewise. * compile/compile-loc2c.c (compute_stack_depth_worker): Likewise. (do_compile_dwarf_expr_to_c): Likewise. * cp-name-parser.y (demangler_special : DEMANGLER_SPECIAL start): Likewise. * dwarf2expr.c (execute_stack_op): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. (disassemble_dwarf_expression): Likewise. * dwarf2read.c (dwarf2_add_member_fn): Likewise. (read_array_order): Likewise. (abbrev_table_read_table): Likewise. (read_attribute_value): Likewise. (skip_unknown_opcode): Likewise. (dwarf_decode_macro_bytes): Likewise. (dwarf_decode_macros): Likewise. * eval.c (value_f90_subarray): Likewise. * guile/scm-param.c (gdbscm_make_parameter): Likewise. * i386-linux-tdep.c (i386_canonicalize_syscall): Likewise. * infrun.c (handle_command): Likewise. * memory-map.c (memory_map_start_memory): Likewise. * osabi.c (set_osabi): Likewise. * parse.c (operator_length_standard): Likewise. * ppc-linux-tdep.c (ppc_canonicalize_syscall): Likewise, and use single return point. * python/py-frame.c (gdbpy_frame_stop_reason_string): Likewise. * python/py-symbol.c (gdbpy_lookup_symbol): Likewise. (gdbpy_lookup_global_symbol): Likewise. * record-full.c (record_full_restore): Likewise. * regcache.c (regcache_register_status): Likewise. (regcache_raw_read): Likewise. (regcache_cooked_read): Likewise. * rs6000-tdep.c (powerpc_set_vector_abi): Likewise. * symtab.c (initialize_ordinary_address_classes): Likewise. * target-debug.h (target_debug_print_signals): Likewise. * utils.c (do_restore_current_language): Likewise.
2015-08-06 23:21:41 +02:00
arm_abi_global = (enum arm_abi_kind) arm_abi;
break;
}
if (arm_abi == ARM_ABI_LAST)
internal_error (__FILE__, __LINE__, _("Invalid ABI accepted: %s."),
arm_abi_string);
arm_update_current_architecture ();
}
static void
arm_show_abi (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch ());
if (arm_abi_global == ARM_ABI_AUTO
&& gdbarch_bfd_arch_info (target_gdbarch ())->arch == bfd_arch_arm)
fprintf_filtered (file, _("\
The current ARM ABI is \"auto\" (currently \"%s\").\n"),
arm_abi_strings[tdep->arm_abi]);
else
fprintf_filtered (file, _("The current ARM ABI is \"%s\".\n"),
arm_abi_string);
}
static void
arm_show_fallback_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
fprintf_filtered (file,
_("The current execution mode assumed "
"(when symbols are unavailable) is \"%s\".\n"),
arm_fallback_mode_string);
}
static void
arm_show_force_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
fprintf_filtered (file,
_("The current execution mode assumed "
"(even when symbols are available) is \"%s\".\n"),
arm_force_mode_string);
}
/* If the user changes the register disassembly style used for info
register and other commands, we have to also switch the style used
in opcodes for disassembly output. This function is run in the "set
arm disassembly" command, and does that. */
static void
Constify add_setshow_* This constifies the add_setshow_* family of functions, and then fixes up the fallout. The bulk of this patch was written by script. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * ada-lang.c (catch_ada_exception_command): Constify. (catch_assert_command): Constify. * break-catch-throw.c (catch_catch_command, catch_throw_command) (catch_rethrow_command): Constify. (catch_exception_command_1): Constify. * breakpoint.h (add_catch_command): Constify. * break-catch-syscall.c (catch_syscall_command_1): Constify. (catch_syscall_split_args): Constify. * break-catch-sig.c (catch_signal_command): Constify. (catch_signal_split_args): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Use cmd_const_sfunc_ftype. * cli/cli-decode.c (add_setshow_cmd_full): Constify. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, struct cmd_list_element) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd): Constify. (set_cmd_sfunc): Constify. (empty_sfunc): Constify. * command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Constify. (set_cmd_sfunc): Constify. (cmd_sfunc_ftype): Remove. * compile/compile.c (set_compile_args): Constify. * infrun.c (set_disable_randomization): Constify. * infcmd.c (set_args_command, set_cwd_command): Constify. * breakpoint.c (set_condition_evaluation_mode): Constify. (add_catch_command): Constify. (catch_fork_command_1, catch_exec_command_1) (catch_load_command_1, catch_unload_command_1): Constify. (catch_load_or_unload): Constify. * guile/scm-param.c (pascm_set_func): Constify. (add_setshow_generic): Constify. * python/py-param.c (get_set_value): Constify. * top.h (set_verbose): Constify. * tui/tui-win.c (tui_set_var_cmd): Constify. * mi/mi-main.c (set_mi_async_command): Constify. * cli/cli-logging.c (set_logging_overwrite) (set_logging_redirect): Constify. * value.c (set_max_value_size): Constify. * valprint.c (set_input_radix, set_output_radix): Constify. * utils.c (set_width_command, set_height_command): Constify. * typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify. * tracepoint.c (set_disconnected_tracing) (set_circular_trace_buffer, set_trace_buffer_size) (set_trace_user, set_trace_notes, set_trace_stop_notes): Constify. * top.c (set_history_size_command, set_verbose, set_editing) (set_gdb_datadir, set_history_filename): Constify. * target.c (set_targetdebug, maint_set_target_async_command) (maint_set_target_non_stop_command, set_target_permissions) (set_write_memory_permission): Constify. (open_target): Constify. * target-descriptions.c (set_tdesc_filename_cmd): Constify. * target-dcache.c (set_stack_cache, set_code_cache): Constify. * symtab.c (set_symbol_cache_size_handler): Constify. * symfile.c (set_ext_lang_command): Constify. * symfile-debug.c (set_debug_symfile): Constify. * source.c (set_directories_command): Constify. * solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify. * serial.c (set_parity): Constify. * rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify. * remote.c (set_remote_exec_file, set_remotebreak) (set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify. * record.c (set_record_insn_history_size) (set_record_call_history_size): Constify. * record-full.c (set_record_full_insn_max_num): Constify. * proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify. * osabi.c (set_osabi): Constify. * mips-tdep.c (set_mips64_transfers_32bit_regs) (reinit_frame_cache_sfunc, mips_abi_update): Constify. * maint.c (maintenance_set_profile_cmd): Constify. * linux-thread-db.c (set_libthread_db_search_path): Constify. * language.c (set_language_command, set_range_command) (set_case_command): Constify. * infrun.c (set_non_stop, set_observer_mode) (set_stop_on_solib_events, set_schedlock_func) (set_exec_direction_func): Constify. * infcmd.c (set_inferior_tty_command): Constify. * disasm.c (set_disassembler_options_sfunc): Constify. * demangle.c (set_demangling_command): Constify. * dcache.c (set_dcache_size, set_dcache_line_size): Constify. * cris-tdep.c (set_cris_version, set_cris_mode) (set_cris_dwarf2_cfi): Constify. * corefile.c (set_gnutarget_command): Constify. * charset.c (set_host_charset_sfunc, set_target_charset_sfunc) (set_target_wide_charset_sfunc): Constify. * breakpoint.c (update_dprintf_commands): Constify. * auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify. * arm-tdep.c (set_fp_model_sfunc, arm_set_abi) (set_disassembly_style_sfunc): Constify. * arch-utils.c (set_endian, set_architecture): Constify. * alpha-tdep.c (reinit_frame_cache_sfunc): Constify. * agent.c (set_can_use_agent): Constify.
2017-10-14 17:07:00 +02:00
set_disassembly_style_sfunc (const char *args, int from_tty,
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
struct cmd_list_element *c)
{
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
/* Convert the short style name into the long style name (eg, reg-names-*)
before calling the generic set_disassembler_options() function. */
std::string long_name = std::string ("reg-names-") + disassembly_style;
set_disassembler_options (&long_name[0]);
}
static void
show_disassembly_style_sfunc (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
struct gdbarch *gdbarch = get_current_arch ();
char *options = get_disassembler_options (gdbarch);
const char *style = "";
int len = 0;
const char *opt;
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
FOR_EACH_DISASSEMBLER_OPTION (opt, options)
if (CONST_STRNEQ (opt, "reg-names-"))
{
style = &opt[strlen ("reg-names-")];
len = strcspn (style, ",");
}
fprintf_unfiltered (file, "The disassembly style is \"%.*s\".\n", len, style);
}
/* Return the ARM register name corresponding to register I. */
static const char *
2007-11-02 Markus Deuling <deuling@de.ibm.com> * gdbarch.sh (register_name): Add gdbarch parameter. * gdbarch.{c,h}: Regenerate. * target-descriptions.c (tdesc_register_name): Add gdbarch parameter. (tdesc_register_name): Replace current_gdbarch by gdbarch. * target-descriptions.h (tdesc_register_name): Add gdbarch parameter. * xstormy16-tdep.c (xstormy16_register_name): Add gdbarch parameter. * vax-tdep.c (vax_register_name): Add gdbarch parameter. * spu-tdep.c (spu_register_name): Add gdbarch parameter. * s390-tdep.c (s390_register_name): Add gdbarch parameter. * mt-tdep.c (mt_register_name): Add gdbarch parameter. (mt_registers_info): Replace current_gdbarch by gdbarch. (mt_register_reggroup_p): Add gdbarch to mt_register_name call. * mips-tdep.c (mips_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (mips_register_name): Add gdbarch to tdesc_register_name call. * mep-tdep.c (mep_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (mep_register_reggroup_p): Add gdbarch to mep_register_name call. * m32c-tdep.c (m32c_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. * m88k-tdep.c (m88k_register_name): Add gdbarch parameter. * m68k-tdep.c (m68k_register_name): Add gdbarch parameter. * m32r-tdep.c (m32r_register_name): Add gdbarch parameter. (m32r_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. * iq2000-tdep.c (iq2000_register_name): Add gdbarch parameter. * ia64-tdep.c (ia64_register_name): Add gdbarch parameter. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Add gdbarch parameter. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Add gdbarch parameter. * cris-tdep.c (cris_register_name, crisv32_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (cris_gdbarch_init): Replace current_gdbarch by gdbarch (comment). * avr-tdep.c (avr_register_name): Add gdbarch parameter. * arm-tdep.c (arm_register_name): Add gdbarch paramete * amd64-tdep.c (amd64_register_name): Add gdbarch parameter. Update caller. * amd64-tdep.h (amd64_register_name): Add gdbarch parameter. * amd64-linux-tdep.c (amd64_linux_register_name): Add gdbarch parameter. * alpha-tdep.c (alpha_register_name): Add gdbarch parameter. (alpha_cannot_fetch_register, alpha_cannot_store_register): Update call of alpha_register_name. * frv-tdep.c (frv_register_name): Add gdbarch parameter. * i386-tdep.c (i386_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (i386_register_type): Replace ?current_gdbarch by gdbarch. * i386-tdep.h (i386_register_name): Add gdbarch parameter. * i386-linux-tdep.c (i386_linux_register_name): Add gdbarch parameter. * m68hc11-tdep.c (m68hc11_register_name): Add gdbarch parameter. (m68hc11_register_reggroup_p): Add gdbarch to call of m68hc11_register_name. * mn10300-tdep.c (mn10300_generic_register_name, am33_register_name) (am33_2_register_name): Add gdbarch parameter. (mn10300_frame_unwind_cache): Use get_frame_arch to get at the current architecture by frame_info. (mn10300_dump_tdep): Replace current_gdbarch by gdbarch. * rs6000-tdep.c (rs6000_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. * score-tdep.c (score_register_name): Add gdbarch parameter. (score_return_value, score_push_dummy_call): Replace current_gdbarch by gdbarch. * sh64-tdep.c (sh64_register_name): Add gdbarch parameter. (sh64_compact_reg_base_num, sh64_register_convert_to_virtual) (sh64_register_convert_to_raw, sh64_fv_reg_base_num) (sh64_dr_reg_base_num, sh64_fpp_reg_base_num): Add gdbarch parameter and update caller. Replace current_gdbarch by gdbarch. (sh64_extract_return_value, sh64_store_return_value): Use get_regcache_arch to get at the current architecture by regcache. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name, sh_sh2a_register_name) (sh_sh2a_nofpu_register_name, sh_sh_dsp_register_name) (sh_sh3_dsp_register_name, sh_sh4_register_name) (sh_sh4_nofpu_register_name, sh_sh4al_dsp_register_name): Add gdbarch parameter. (fv_reg_base_num, dr_reg_base_num, sh_justify_value_in_reg) (sh_next_flt_argreg): Add gdbarch parameter and update caller. Replace current_gdbarch by gdbarch. (sh_extract_return_value_fpu, sh_store_return_value_fpu): Use get_regcache_arch to get at the current architecture by regcache. * sparc-tdep.c (sparc32_register_name): Add gdbarch parameter. * sparc64-tdep.c (sparc64_register_name): Add gdbarch parameter. * v850-tdep.c (v850_register_name, v850e_register_name): Add gdbarch parameter. (v850_unwind_sp, v850_unwind_pc): Replace current_gdbarch by gdbarch. * xtensa-tdep.c (xtensa_register_name): Add gdbarch parameter. Replace current_gdbarch by gdbarch. (xtensa_pseudo_register_read, xtensa_pseudo_register_write) (xtensa_frame_prev_register): Add gdbarch parameter to xtensa_register_name call.
2007-11-02 15:27:15 +01:00
arm_register_name (struct gdbarch *gdbarch, int i)
{
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
const int num_regs = gdbarch_num_regs (gdbarch);
if (gdbarch_tdep (gdbarch)->have_vfp_pseudos
&& i >= num_regs && i < num_regs + 32)
{
static const char *const vfp_pseudo_names[] = {
"s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
"s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15",
"s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23",
"s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31",
};
return vfp_pseudo_names[i - num_regs];
}
if (gdbarch_tdep (gdbarch)->have_neon_pseudos
&& i >= num_regs + 32 && i < num_regs + 32 + 16)
{
static const char *const neon_pseudo_names[] = {
"q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7",
"q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15",
};
return neon_pseudo_names[i - num_regs - 32];
}
if (i >= ARRAY_SIZE (arm_register_names))
/* These registers are only supported on targets which supply
an XML description. */
return "";
return arm_register_names[i];
}
/* Test whether the coff symbol specific value corresponds to a Thumb
function. */
static int
coff_sym_is_thumb (int val)
{
return (val == C_THUMBEXT
|| val == C_THUMBSTAT
|| val == C_THUMBEXTFUNC
|| val == C_THUMBSTATFUNC
|| val == C_THUMBLABEL);
}
/* arm_coff_make_msymbol_special()
arm_elf_make_msymbol_special()
These functions test whether the COFF or ELF symbol corresponds to
an address in thumb code, and set a "special" bit in a minimal
symbol to indicate that it does. */
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
static void
arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
{
elf_symbol_type *elfsym = (elf_symbol_type *) sym;
if (ARM_GET_SYM_BRANCH_TYPE (elfsym->internal_elf_sym.st_target_internal)
== ST_BRANCH_TO_THUMB)
MSYMBOL_SET_SPECIAL (msym);
}
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
static void
arm_coff_make_msymbol_special(int val, struct minimal_symbol *msym)
{
if (coff_sym_is_thumb (val))
MSYMBOL_SET_SPECIAL (msym);
}
static void
arm_record_special_symbol (struct gdbarch *gdbarch, struct objfile *objfile,
asymbol *sym)
{
const char *name = bfd_asymbol_name (sym);
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
struct arm_per_bfd *data;
struct arm_mapping_symbol new_map_sym;
gdb_assert (name[0] == '$');
if (name[1] != 'a' && name[1] != 't' && name[1] != 'd')
return;
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
data = arm_bfd_data_key.get (objfile->obfd);
if (data == NULL)
[ARM, thumb] Fix disassembling bug after reloading a symbol file The speed optimization from commit 5f6cac4085c95c5339b9549dc06d4f9184184fa6 made GDB skip reloading all symbols when the same symbol file is reloaded. As a result, ARM targets only read the mapping symbols the first time we load a symbol file. When reloaded, the speed optimization above will cause an early return and gdbarch_record_special_symbol won't be called to save mapping symbol data, which in turn affects disassembling of thumb instructions. First load and correct disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: mov r0, #0 0x00008224 <+8>: bx lr Second load and incorrect disassemble output: Dump of assembler code for function main: 0x0000821c <+0>: bx pc 0x0000821e <+2>: nop 0x00008220 <+4>: movs r0, r0 0x00008222 <+6>: b.n 0x8966 0x00008224 <+8>: vrhadd.u16 d14, d14, d31 This happens because the mapping symbol data is stored in an objfile_key-based container, and that data isn't preserved across the two symbol loading operations. The following patch fixes this by storing the mapping symbol data in a bfd_key-based container, which doesn't change as long as the bfd is the same. I've also added a new test to verify the correct disassemble output. gdb/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * arm-tdep.c (arm_per_objfile): Rename to ... (arm_per_bfd): ... this. (arm_objfile_data_key): Rename to ... (arm_bfd_data_key): ... this. (arm_find_mapping_symbol): Adjust access to new bfd_key-based data. (arm_record_special_symbol): Likewise. gdb/testsuite/ChangeLog: 2019-11-01 Luis Machado <luis.machado@linaro.org> PR gdb/25124 * gdb.arch/pr25124.S: New file. * gdb.arch/pr25124.exp: New file. Change-Id: I22c3e6ebe9bfedad66d56fe9656994fa1761c485
2019-11-01 14:11:17 +01:00
data = arm_bfd_data_key.emplace (objfile->obfd,
objfile->obfd->section_count);
arm_mapping_symbol_vec &map
= data->section_maps[bfd_asymbol_section (sym)->index];
new_map_sym.value = sym->value;
new_map_sym.type = name[1];
arm-tdep: sort mapping symbols after parsing all minimal symbols Somebody on IRC reported a while ago that loading a big ARM program in GDB was very slow. Their profiling pointed out that a big amount of time was spent in VEC_safe_insert (arm_mapping_symbol_s, *map_p, idx, &new_map_sym); I was able to verify this as well. ARM mapping symbols are special ELF symbols named $a, $d and $t indicating that symbols starting at this address up to the next mapping symbol (in terms of address) are of type "ARM code", "data" and "Thumb code", respectively. GDB records these symbols in vectors (one for each section) in arm-tdep.c. These vectors are sorted by symbol address, to allow for quick lookup. The current approach is to insert new symbols at the right position to keep the vectors sorted at all time. This is done based on the assumption that mapping symbols come already almost sorted from the binary, as explains this comment in arm_record_special_symbol: /* Assume that most mapping symbols appear in order of increasing value. If they were randomly distributed, it would be faster to always push here and then sort at first use. */ Well, it turns out this is not the case. The original reporter mentioned that mapping symbols in their binaries are not nearly sorted, and this is not my experience either (at least in the binary used in the benchmark below). So if the values don't come nearly sorted, doing insertions to keep the vectors sorted ends up being of the order of number_of_mapping_symbols ^ 2. This patch changes it just like the comment above says, to just append to the vector in arm_record_special_symbol and sort the vector on first use. Benchmark ========= I have done some benchmarks using an --enable-targets=all GDB, compiled with -O2, running on x86-64 and parsing file dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug from this package: https://launchpad.net/ubuntu/+source/firefox/66.0.3+build1-0ubuntu1/+build/16608691/+files/firefox-dbg_66.0.3+build1-0ubuntu1_armhf.deb This file is the separate debug info for libxul.so (part of firefox) for ARM. I have added some traces to measure the execution time of just elf_symtab_read and ran GDB like this: ./gdb --data-directory=data-directory -nx -batch .../path/to/usr/lib/debug/.build-id/65/dce18d22e5c2ecb6a3a57372f4e6ef614130bc.debug Since the new code sorts the vectors on first use, it would be difficult to benchmark it as-is and be fair, since the "before" version does more work in elf_symtab_read. So I have actually benchmarked a version of the patch that did sort all the vectors at the end of elf_symtab_read, so the sorting would be considered in the measured execution time. Here's the measured execution time of elf_symtab_read, averaged on 3 runs: insert sorted (before): 28.678s sort after (after): 1.760s And here's the total execution time of the command above (just one run). The time is now mostly spent in reading DWARF. insert sorted: 71.12s user 2.71s system 99% cpu 1:14.03 total sort after: 46.42s user 2.60s system 99% cpu 49.147 total I tried for fun on my Raspberry Pi 3, the run time of elf_symtab_read goes from ~259s to ~9s, reading the same file. gdb/ChangeLog: * arm-tdep.c (struct arm_per_objfile) <section_maps_sorted>: New field. (arm_find_mapping_symbol): Sort mapping symbol vectors on first use. (arm_record_special_symbol): Don't insert new symbol in sorted position, push it at the end.
2019-06-25 20:22:30 +02:00
/* Insert at the end, the vector will be sorted on first use. */
map.push_back (new_map_sym);
}
static void
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
arm_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
s/get_regcache_arch (regcache)/regcache->arch ()/g This patches removes get_regcache_arch, and use regache->arch () instead. The motivation of this change is that I am going to move some basic stuff into a base class of regcache. I don't need to update "client" code regcache->arch (). On the other hand, this patch shortens the code a little bit. gdb: 2017-10-25 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_supply): Use regcache->arch () instead get_regcache_arch. * aarch64-fbsd-nat.c (aarch64_fbsd_fetch_inferior_registers): Likewise. (aarch64_fbsd_store_inferior_registers): Likewise. * aarch64-linux-nat.c (fetch_gregs_from_thread): Likewise. (store_gregs_to_thread): Likewise. (fetch_fpregs_from_thread): Likewise. (store_fpregs_to_thread): Likewise. * aarch64-tdep.c (aarch64_extract_return_value): Likewise. (aarch64_store_return_value): Likewise. (aarch64_software_single_step): Likewise. * aix-thread.c (aix_thread_wait): Likewise. (supply_reg32): Likewise. (supply_sprs64): Likewise. (supply_sprs32): Likewise. (fill_gprs64): Likewise. (fill_gprs32): Likewise. (fill_sprs64): Likewise. (fill_sprs32): Likewise. (store_regs_user_thread): Likewise. (store_regs_kernel_thread): Likewise. * alpha-bsd-nat.c (alphabsd_fetch_inferior_registers): Likewise. (alphabsd_store_inferior_registers): Likewise. * alpha-tdep.c (alpha_extract_return_value): Likewise. (alpha_store_return_value): Likewise. (alpha_deal_with_atomic_sequence): Likewise. (alpha_next_pc): Likewise. (alpha_software_single_step): Likewise. * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Likewise. (amd64bsd_store_inferior_registers): Likewise. * amd64-linux-nat.c (amd64_linux_fetch_inferior_registers): Likewise. (amd64_linux_store_inferior_registers): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-obsd-tdep.c (amd64obsd_supply_uthread): Likewise. (amd64obsd_collect_uthread): Likewise. * amd64-tdep.c (amd64_supply_fpregset): Likewise. (amd64_collect_fpregset): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * arc-tdep.c (arc_write_pc): Likewise. * arch-utils.c (default_skip_permanent_breakpoint): Likewise. * arm-fbsd-nat.c (arm_fbsd_fetch_inferior_registers): Likewise. (arm_fbsd_store_inferior_registers): Likewise. * arm-linux-nat.c (fetch_vfp_regs): Likewise. (store_vfp_regs): Likewise. (arm_linux_fetch_inferior_registers): Likewise. (arm_linux_store_inferior_registers): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_sigreturn_next_pc): Likewise. (arm_linux_get_next_pcs_syscall_next_pc): Likewise. * arm-nbsd-nat.c (arm_supply_gregset): Likewise. (fetch_register): Likewise. (store_register): Likewise. * arm-tdep.c (arm_is_thumb): Likewise. (displaced_in_arm_mode): Likewise. (bx_write_pc): Likewise. (arm_get_next_pcs_addr_bits_remove): Likewise. (arm_software_single_step): Likewise. (arm_extract_return_value): Likewise. (arm_store_return_value): Likewise. (arm_write_pc): Likewise. * bfin-tdep.c (bfin_extract_return_value): Likewise. * bsd-uthread.c (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * core-regset.c (fetch_core_registers): Likewise. * corelow.c (get_core_registers): Likewise. * cris-tdep.c (cris_store_return_value): Likewise. (cris_extract_return_value): Likewise. (find_step_target): Likewise. (find_step_target): Likewise. (cris_software_single_step): Likewise. * ctf.c (ctf_fetch_registers): Likewise. * darwin-nat.c (cancel_breakpoint): Likewise. * fbsd-tdep.c (fbsd_collect_thread_registers): Likewise. * frv-tdep.c (frv_extract_return_value): Likewise. * ft32-tdep.c (ft32_store_return_value): Likewise. (ft32_extract_return_value): Likewise. * go32-nat.c (fetch_register): Likewise. (go32_fetch_registers): Likewise. (go32_store_registers): Likewise. (store_register): Likewise. * h8300-tdep.c (h8300_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * hppa-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (hppa_linux_fetch_inferior_registers): Likewise. (hppa_linux_store_inferior_registers): Likewise. * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers): Likewise. (i386_darwin_store_inferior_registers): Likewise. * i386-gnu-nat.c (gnu_fetch_registers): Likewise. (gnu_store_registers): Likewise. * i386-linux-nat.c (fetch_register): Likewise. (store_register): Likewise. (supply_gregset): Likewise. (fill_gregset): Likewise. (i386_linux_fetch_inferior_registers): Likewise. (i386_linux_store_inferior_registers): Likewise. (i386_linux_resume): Likewise. * i386-linux-tdep.c (i386_linux_get_syscall_number_from_regcache): Likewise. * i386-nto-tdep.c (i386nto_supply_gregset): Likewise. * i386-obsd-nat.c (i386obsd_supply_pcb): Likewise. * i386-obsd-tdep.c (i386obsd_supply_uthread): Likewise. (i386obsd_collect_uthread): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_supply_fpregset): Likewise. (i386_collect_fpregset): Likewise. (i386_mpx_bd_base): Likewise. * i386-v4-nat.c (supply_fpregset): Likewise. (fill_fpregset): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-linux-nat.c (ia64_linux_fetch_registers): Likewise. (ia64_linux_store_registers): Likewise. * ia64-tdep.c (ia64_access_rse_reg): Likewise. (ia64_extract_return_value): Likewise. (ia64_store_return_value): Likewise. (find_func_descr): Likewise. * inf-child.c (inf_child_fetch_inferior_registers): Likewise. * inf-ptrace.c (inf_ptrace_fetch_registers): Likewise. (inf_ptrace_store_registers): Likewise. * infrun.c (use_displaced_stepping): Likewise. (displaced_step_prepare_throw): Likewise. (resume): Likewise. (proceed): Likewise. (do_target_wait): Likewise. (adjust_pc_after_break): Likewise. (handle_inferior_event_1): Likewise. (handle_signal_stop): Likewise. (save_infcall_suspend_state): Likewise. (restore_infcall_suspend_state): Likewise. * iq2000-tdep.c (iq2000_extract_return_value): Likewise. * jit.c (jit_frame_prev_register): Likewise. * linux-nat.c (save_stop_reason): Likewise. (linux_nat_wait_1): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-record.c (record_linux_sockaddr): Likewise. (record_linux_msghdr): Likewise. (record_linux_system_call): Likewise. * linux-tdep.c (linux_collect_thread_registers): Likewise. * lm32-tdep.c (lm32_extract_return_value): Likewise. (lm32_store_return_value): Likewise. * m32c-tdep.c (m32c_read_flg): Likewise. (m32c_pseudo_register_read): Likewise. (m32c_pseudo_register_write): Likewise. * m32r-linux-tdep.c (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_store_return_value): Likewise. (m32r_extract_return_value): Likewise. * m68k-bsd-nat.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_collect_fpregset): Likewise. * m68k-bsd-tdep.c (m68kbsd_supply_fpregset): Likewise. * m68k-linux-nat.c (fetch_register): Likewise. (old_fetch_inferior_registers): Likewise. (old_store_inferior_registers): Likewise. (store_regs): Likewise. * m68k-tdep.c (m68k_svr4_extract_return_value): Likewise. (m68k_svr4_store_return_value): Likewise. * m88k-tdep.c (m88k_store_arguments): Likewise. * mi/mi-main.c (mi_cmd_data_list_changed_registers): Likewise. (mi_cmd_data_write_register_values): Likewise. * mips-fbsd-nat.c (mips_fbsd_fetch_inferior_registers): Likewise. (mips_fbsd_store_inferior_registers): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_fpregs): Likewise. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise. (mips_fbsd_supply_fpregset): Likewise. (mips_fbsd_collect_fpregset): Likewise. (mips_fbsd_supply_gregset): Likewise. (mips_fbsd_collect_gregset): Likewise. * mips-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (supply_fpregset): Likewise. (fill_fpregset): Likewise. * mips-linux-tdep.c (mips_supply_gregset): Likewise. (mips_fill_gregset): Likewise. (mips_supply_fpregset): Likewise. (mips_fill_fpregset): Likewise. (mips64_supply_gregset): Likewise. (micromips_linux_sigframe_validate): Likewise. * mips-nbsd-nat.c (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_fetch_inferior_registers): Likewise. (mipsnbsd_store_inferior_registers): Likewise. * mips-nbsd-tdep.c (mipsnbsd_supply_fpregset): Likewise. (mipsnbsd_supply_gregset): Likewise. (mipsnbsd_iterate_over_regset_sections): Likewise. (mipsnbsd_supply_reg): Likewise. (mipsnbsd_supply_fpreg): Likewise. * mips-tdep.c (mips_in_frame_stub): Likewise. (mips_dummy_id): Likewise. (is_octeon_bbit_op): Likewise. (micromips_bc1_pc): Likewise. (extended_mips16_next_pc): Likewise. (mips16_next_pc): Likewise. (deal_with_atomic_sequence): Likewise. * moxie-tdep.c (moxie_process_readu): Likewise. * nios2-tdep.c (nios2_get_next_pc): Likewise. * nto-procfs.c (procfs_store_registers): Likewise. * ppc-fbsd-nat.c (ppcfbsd_fetch_inferior_registers): Likewise. (ppcfbsd_store_inferior_registers): Likewise. * ppc-linux-nat.c (fetch_vsx_register): Likewise. (fetch_altivec_register): Likewise. (get_spe_registers): Likewise. (fetch_spe_register): Likewise. (fetch_altivec_registers): Likewise. (fetch_all_gp_regs): Likewise. (fetch_all_fp_regs): Likewise. (store_vsx_register): Likewise. (store_altivec_register): Likewise. (set_spe_registers): Likewise. (store_spe_register): Likewise. (store_altivec_registers): Likewise. (store_all_gp_regs): Likewise. (store_all_fp_regs): Likewise. * ppc-linux-tdep.c (ppc_linux_supply_gregset): Likewise. (ppc_linux_collect_gregset): Likewise. (ppc_canonicalize_syscall): Likewise. (ppc_linux_record_signal): Likewise. (ppu2spu_prev_register): Likewise. * ppc-nbsd-nat.c (ppcnbsd_supply_pcb): Likewise. * ppc-obsd-nat.c (ppcobsd_fetch_registers): Likewise. (ppcobsd_store_registers): Likewise. * ppc-ravenscar-thread.c (ppc_ravenscar_generic_fetch_registers): Likewise. (ppc_ravenscar_generic_store_registers): Likewise. * procfs.c (procfs_fetch_registers): Likewise. (procfs_store_registers): Likewise. * ravenscar-thread.c (ravenscar_fetch_registers): Likewise. (ravenscar_store_registers): Likewise. (ravenscar_prepare_to_store): Likewise. * record-btrace.c (record_btrace_fetch_registers): Likewise. * record-full.c (record_full_wait_1): Likewise. (record_full_registers_change): Likewise. (record_full_store_registers): Likewise. (record_full_core_fetch_registers): Likewise. (record_full_save): Likewise. (record_full_goto_insn): Likewise. * regcache.c (regcache_register_size): Likewise. (get_regcache_arch): Remove. (regcache_read_pc): Likewise. * regcache.h (get_regcache_arch): Remove. * remote-sim.c (gdbsim_fetch_register): Likewise. (gdbsim_store_register): Likewise. * remote.c (fetch_register_using_p): Likewise. (send_g_packet): Likewise. (remote_prepare_to_store): Likewise. (store_registers_using_G): Likewise. * reverse.c (save_bookmark_command): Likewise. (goto_bookmark_command): Likewise. * rs6000-aix-tdep.c (branch_dest): Likewise. * rs6000-nat.c (rs6000_ptrace64): Likewise. (fetch_register): Likewise. * rs6000-tdep.c (ppc_supply_reg): Likewise. (ppc_collect_reg): Likewise. (ppc_collect_gregset): Likewise. (ppc_collect_fpregset): Likewise. (ppc_collect_vsxregset): Likewise. (ppc_collect_vrregset): Likewise. (ppc_displaced_step_hw_singlestep): Likewise. (rs6000_pseudo_register_read): Likewise. (rs6000_pseudo_register_write): Likewise. * s390-linux-nat.c (supply_gregset): Likewise. (fill_gregset): Likewise. (s390_linux_fetch_inferior_registers): Likewise. * s390-linux-tdep.c (s390_write_pc): Likewise. (s390_software_single_step): Likewise. (s390_all_but_pc_registers_record): Likewise. (s390_linux_syscall_record): Likewise. * sentinel-frame.c (sentinel_frame_prev_arch): Likewise. * sh-nbsd-nat.c (shnbsd_fetch_inferior_registers): Likewise. (shnbsd_store_inferior_registers): Likewise. * sh-tdep.c (sh_extract_return_value_nofpu): Likewise. (sh_extract_return_value_fpu): Likewise. (sh_store_return_value_nofpu): Likewise. (sh_corefile_supply_regset): Likewise. (sh_corefile_collect_regset): Likewise. * sh64-tdep.c (sh64_extract_return_value): Likewise. (sh64_store_return_value): Likewise. * sparc-linux-tdep.c (sparc32_linux_collect_core_fpregset): Likewise. * sparc-nat.c (sparc_fetch_inferior_registers): Likewise. (sparc_store_inferior_registers): Likewise. * sparc-ravenscar-thread.c (register_in_thread_descriptor_p): Likewise. (sparc_ravenscar_prepare_to_store): Likewise. * sparc-tdep.c (sparc32_store_arguments): Likewise. (sparc_analyze_control_transfer): Likewise. (sparc_step_trap): Likewise. (sparc_software_single_step): Likewise. (sparc32_gdbarch_init): Likewise. (sparc_supply_rwindow): Likewise. (sparc_collect_rwindow): Likewise. * sparc64-linux-tdep.c (sparc64_linux_collect_core_fpregset): Likewise. * sparc64-nbsd-nat.c (sparc64nbsd_supply_gregset): Likewise. (sparc64nbsd_collect_gregset): Likewise. (sparc64nbsd_supply_fpregset): Likewise. (sparc64nbsd_collect_fpregset): Likewise. * sparc64-tdep.c (sparc64_store_arguments): Likewise. (sparc64_supply_gregset): Likewise. (sparc64_collect_gregset): Likewise. (sparc64_supply_fpregset): Likewise. (sparc64_collect_fpregset): Likewise. * spu-linux-nat.c (spu_fetch_inferior_registers): Likewise. * spu-tdep.c (spu_unwind_sp): Likewise. (spu2ppu_prev_register): Likewise. (spu_memory_remove_breakpoint): Likewise. * stack.c (return_command): Likewise. * tic6x-tdep.c (tic6x_extract_signed_field): Likewise. * tracefile-tfile.c (tfile_fetch_registers): Likewise. * tracefile.c (trace_save_ctf): Likewise. * windows-nat.c (do_windows_fetch_inferior_registers): Likewise. (do_windows_store_inferior_registers): Likewise. (windows_resume): Likewise. * xtensa-linux-nat.c (fill_gregset): Likewise. (supply_gregset_reg): Likewise. * xtensa-tdep.c (xtensa_register_write_masked): Likewise. (xtensa_register_read_masked): Likewise. (xtensa_supply_gregset): Likewise. (xtensa_extract_return_value): Likewise. (xtensa_store_return_value): Likewise.
2017-10-25 17:37:03 +02:00
struct gdbarch *gdbarch = regcache->arch ();
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
regcache_cooked_write_unsigned (regcache, ARM_PC_REGNUM, pc);
/* If necessary, set the T bit. */
if (arm_apcs_32)
{
ULONGEST val, t_bit;
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
regcache_cooked_read_unsigned (regcache, ARM_PS_REGNUM, &val);
t_bit = arm_psr_thumb_bit (gdbarch);
if (arm_pc_is_thumb (gdbarch, pc))
regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM,
val | t_bit);
else
* gdbarch.sh (read_pc): Add REGCACHE argument. Remove PTID argument. (write_pc): Likewise. Remove default implementation, add predicate. * gdbarch.c, gdbarch.h: Regenerate. * regcache.c (read_pc_pid): Use current regcache instead of calling read_register_pid. (write_pc_pid): Check gdbarch_write_pc predicate, implement default case inline. (generic_target_write_pc): Remove. * inferior.h (generic_target_write_pc): Remove. * frv-tdep.c (frv_gdbarch_init): Do not install it. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * rs6000-tdep.c (rs6000_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * avr-tdep.c (avr_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_register_pid. * hppa-hpux-tdep.c (hppa_hpux_read_pc): Likewise. * hppa-tdep.c (hppa_read_pc): Likewise. * hppa-tdep.h (hppa_read_pc): Likewise. * ia64-tdep.c (ia64_read_pc): Likewise. * m32r-tdep.c (m32r_read_pc): Likewise. * mep-tdep.c (mep_read_pc): Likewise. * mn10300-tdep.c (mn10300_read_pc): Likewise. * spu-tdep.c (spu_read_pc): Likewise. * arm-tdep.c (arm_write_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling write_register_pid. * avr-tdep.c (avr_write_pc): Likewise. * hppa-hpux-tdep.c (hppa_hpux_write_pc): Likewise. * hppa-tdep.c (hppa_write_pc): Likewise. * hppa-tdep.h (hppa_write_pc): Likewise. * i386-linux-tdep.c (i386_linux_write_pc): Likewise. * amd64-linux-tdep.c (amd64_linux_write_pc): Likewise. * ia64-linux-tdep.c (ia64_linux_write_pc): Likewise. * ia64-tdep.c (ia64_write_pc): Likewise. * ia64-tdep.h (ia64_write_pc): Likewise. * m32r-tdep.c (m32r_write_pc): Likewise. * m88k-tdep.c (m88k_write_pc): Likewise. * mep-tdep.c (mep_write_pc): Likewise. * mips-tdep.c (mips_write_pc): Likewise. * mips-linux-tdep.c (mips_linux_write_pc): Likewise. * mn10300-tdep.c (mn10300_write_pc): Likewise. * sparc-tdep.c (sparc_write_pc): Likewise. * spu-tdep.c (spu_write_pc): Likewise. * mips-tdep.c (read_signed_register): Remove. (read_signed_register_pid): Likewise. (mips_read_pc): Add REGCACHE argument. Remove PTID argument. Use REGCACHE instead of calling read_signed_register_pid.
2007-06-16 00:44:56 +02:00
regcache_cooked_write_unsigned (regcache, ARM_PS_REGNUM,
val & ~t_bit);
}
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* Read the contents of a NEON quad register, by reading from two
double registers. This is used to implement the quad pseudo
registers, and for argument passing in case the quad registers are
missing; vectors are passed in quad registers when using the VFP
ABI, even if a NEON unit is not present. REGNUM is the index of
the quad register, in [0, 15]. */
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
static enum register_status
class readable_regcache and pass readable_regcache to gdbarch pseudo_register_read and pseudo_register_read_value pseudo registers are either from raw registers or memory, so gdbarch methods pseudo_register_read and pseudo_register_read_value should have regcache object which only have read methods. In other words, we should disallow writing to regcache in these two gdbarch methods. In order to apply this restriction, this patch adds a new class readable_regcache, derived from reg_buffer, and it only has raw_read and cooked_read methods. regcache is derived from readable_regcache. This patch also passes readable_regcache instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. This patch moves raw_read* and cooked_read* methods to readable_regcache, which is straightforward. One thing not straightforward is that I split regcache::xfer_part to readable_regcache::read_part and regcache::write_part, because readable_regcache can only have methods to read. readable_regcache is an abstract base class, and it has a pure virtual function raw_update, because I don't want readable_regcache know where these raw registers are from. They can be from either the target (readwrite regcache) or the regcache itself (readonly regcache). gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_register_read_value): Change parameter type to 'readable_regcache *'. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. (arm_pseudo_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * gdbarch.c: Re-generated. * gdbarch.h: Re-generated. * gdbarch.sh (pseudo_register_read): Change parameter type to 'readable_regcache *'. (pseudo_register_read_value): Likewise. * h8300-tdep.c (pseudo_from_raw_register): Likewise. (h8300_pseudo_register_read): Likewise. * hppa-tdep.c (hppa_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. (i386_pseudo_register_read_value): Likewise. * i386-tdep.h (i386_pseudo_register_read_into_value): Update declaration. * ia64-tdep.c (ia64_pseudo_register_read): Likewise. * m32c-tdep.c (m32c_raw_read): Likewise. (m32c_read_flg): Likewise. (m32c_banked_register): Likewise. (m32c_banked_read): Likewise. (m32c_sb_read): Likewise. (m32c_part_read): Likewise. (m32c_cat_read): Likewise. (m32c_r3r2r1r0_read): Likewise. (m32c_pseudo_register_read): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_register_read): Likewise. * mips-tdep.c (mips_pseudo_register_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * regcache.c (regcache::raw_read): Move it to readable_regcache. (regcache::cooked_read): Likewise. (regcache::cooked_read_value): Likewise. (regcache_cooked_read_signed): (regcache::cooked_read): Likewise. * regcache.h (readable_regcache): New class. (regcache): Inherit readable_regcache. Move some methods to readable_regcache. * rl78-tdep.c (rl78_pseudo_register_read): Change parameter type to 'readable_regcache *'. * rs6000-tdep.c (do_regcache_raw_read): Remove. (e500_pseudo_register_read): Change parameter type to 'readable_regcache *'. (dfp_pseudo_register_read): Likewise. (vsx_pseudo_register_read): Likewise. (efpr_pseudo_register_read): Likewise. * s390-tdep.c (s390_pseudo_register_read): Likewise. * sh-tdep.c (sh_pseudo_register_read): Likewise. * sh64-tdep.c (pseudo_register_read_portions): Likewise. (sh64_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. (spu_pseudo_register_read): Likewise. * xtensa-tdep.c (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Likewise.
2018-02-21 12:20:03 +01:00
arm_neon_quad_read (struct gdbarch *gdbarch, readable_regcache *regcache,
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
int regnum, gdb_byte *buf)
{
char name_buf[4];
gdb_byte reg_buf[8];
int offset, double_regnum;
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status status;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum << 1);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
/* d0 is always the least significant half of q0. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = 8;
else
offset = 0;
Replace regcache_raw_read with regcache->raw_read The patch later in this series will move regcache's raw_read and cooked_read methods to a new class regcache_read, and regcache is dervied from it. Also pass regcache_read instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. In order to prepare for this change, this patch changes regcache_raw_read to regcache->raw_read. On the other hand, since we are in C++, I prefer using class method (regcache->raw_read). gdb: 2018-01-22 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_read_value): Call regcache method raw_read instead of regcache_raw_read. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * h8300-tdep.c (h8300_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * rl78-tdep.c (rl78_pseudo_register_read): Likewise. * s390-linux-tdep.c (s390_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. * xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
2018-01-22 12:02:49 +01:00
status = regcache->raw_read (double_regnum, reg_buf);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (status != REG_VALID)
return status;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
memcpy (buf + offset, reg_buf, 8);
offset = 8 - offset;
Replace regcache_raw_read with regcache->raw_read The patch later in this series will move regcache's raw_read and cooked_read methods to a new class regcache_read, and regcache is dervied from it. Also pass regcache_read instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. In order to prepare for this change, this patch changes regcache_raw_read to regcache->raw_read. On the other hand, since we are in C++, I prefer using class method (regcache->raw_read). gdb: 2018-01-22 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_read_value): Call regcache method raw_read instead of regcache_raw_read. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * h8300-tdep.c (h8300_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * rl78-tdep.c (rl78_pseudo_register_read): Likewise. * s390-linux-tdep.c (s390_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. * xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
2018-01-22 12:02:49 +01:00
status = regcache->raw_read (double_regnum + 1, reg_buf);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (status != REG_VALID)
return status;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
memcpy (buf + offset, reg_buf, 8);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
return REG_VALID;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
}
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
static enum register_status
class readable_regcache and pass readable_regcache to gdbarch pseudo_register_read and pseudo_register_read_value pseudo registers are either from raw registers or memory, so gdbarch methods pseudo_register_read and pseudo_register_read_value should have regcache object which only have read methods. In other words, we should disallow writing to regcache in these two gdbarch methods. In order to apply this restriction, this patch adds a new class readable_regcache, derived from reg_buffer, and it only has raw_read and cooked_read methods. regcache is derived from readable_regcache. This patch also passes readable_regcache instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. This patch moves raw_read* and cooked_read* methods to readable_regcache, which is straightforward. One thing not straightforward is that I split regcache::xfer_part to readable_regcache::read_part and regcache::write_part, because readable_regcache can only have methods to read. readable_regcache is an abstract base class, and it has a pure virtual function raw_update, because I don't want readable_regcache know where these raw registers are from. They can be from either the target (readwrite regcache) or the regcache itself (readonly regcache). gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_register_read_value): Change parameter type to 'readable_regcache *'. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. (arm_pseudo_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * gdbarch.c: Re-generated. * gdbarch.h: Re-generated. * gdbarch.sh (pseudo_register_read): Change parameter type to 'readable_regcache *'. (pseudo_register_read_value): Likewise. * h8300-tdep.c (pseudo_from_raw_register): Likewise. (h8300_pseudo_register_read): Likewise. * hppa-tdep.c (hppa_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. (i386_pseudo_register_read_value): Likewise. * i386-tdep.h (i386_pseudo_register_read_into_value): Update declaration. * ia64-tdep.c (ia64_pseudo_register_read): Likewise. * m32c-tdep.c (m32c_raw_read): Likewise. (m32c_read_flg): Likewise. (m32c_banked_register): Likewise. (m32c_banked_read): Likewise. (m32c_sb_read): Likewise. (m32c_part_read): Likewise. (m32c_cat_read): Likewise. (m32c_r3r2r1r0_read): Likewise. (m32c_pseudo_register_read): Likewise. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. (mep_pseudo_cr64_read): Likewise. (mep_pseudo_register_read): Likewise. * mips-tdep.c (mips_pseudo_register_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * regcache.c (regcache::raw_read): Move it to readable_regcache. (regcache::cooked_read): Likewise. (regcache::cooked_read_value): Likewise. (regcache_cooked_read_signed): (regcache::cooked_read): Likewise. * regcache.h (readable_regcache): New class. (regcache): Inherit readable_regcache. Move some methods to readable_regcache. * rl78-tdep.c (rl78_pseudo_register_read): Change parameter type to 'readable_regcache *'. * rs6000-tdep.c (do_regcache_raw_read): Remove. (e500_pseudo_register_read): Change parameter type to 'readable_regcache *'. (dfp_pseudo_register_read): Likewise. (vsx_pseudo_register_read): Likewise. (efpr_pseudo_register_read): Likewise. * s390-tdep.c (s390_pseudo_register_read): Likewise. * sh-tdep.c (sh_pseudo_register_read): Likewise. * sh64-tdep.c (pseudo_register_read_portions): Likewise. (sh64_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. (spu_pseudo_register_read): Likewise. * xtensa-tdep.c (xtensa_register_read_masked): Likewise. (xtensa_pseudo_register_read): Likewise.
2018-02-21 12:20:03 +01:00
arm_pseudo_read (struct gdbarch *gdbarch, readable_regcache *regcache,
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
int regnum, gdb_byte *buf)
{
const int num_regs = gdbarch_num_regs (gdbarch);
char name_buf[4];
gdb_byte reg_buf[8];
int offset, double_regnum;
gdb_assert (regnum >= num_regs);
regnum -= num_regs;
if (gdbarch_tdep (gdbarch)->have_neon_pseudos && regnum >= 32 && regnum < 48)
/* Quad-precision register. */
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
return arm_neon_quad_read (gdbarch, regcache, regnum - 32, buf);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
else
{
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
enum register_status status;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* Single-precision register. */
gdb_assert (regnum < 32);
/* s0 is always the least significant half of d0. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = (regnum & 1) ? 0 : 4;
else
offset = (regnum & 1) ? 4 : 0;
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum >> 1);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
Replace regcache_raw_read with regcache->raw_read The patch later in this series will move regcache's raw_read and cooked_read methods to a new class regcache_read, and regcache is dervied from it. Also pass regcache_read instead of regcache to gdbarch methods pseudo_register_read and pseudo_register_read_value. In order to prepare for this change, this patch changes regcache_raw_read to regcache->raw_read. On the other hand, since we are in C++, I prefer using class method (regcache->raw_read). gdb: 2018-01-22 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (aarch64_pseudo_read_value): Call regcache method raw_read instead of regcache_raw_read. * amd64-tdep.c (amd64_pseudo_register_read_value): Likewise. * arm-tdep.c (arm_neon_quad_read): Likewise. * avr-tdep.c (avr_pseudo_register_read): Likewise. * bfin-tdep.c (bfin_pseudo_register_read): Likewise. * frv-tdep.c (frv_pseudo_register_read): Likewise. * h8300-tdep.c (h8300_pseudo_register_read): Likewise. * i386-tdep.c (i386_mmx_regnum_to_fp_regnum): Likewise. (i386_pseudo_register_read_into_value): Likewise. * mep-tdep.c (mep_pseudo_cr32_read): Likewise. * msp430-tdep.c (msp430_pseudo_register_read): Likewise. * nds32-tdep.c (nds32_pseudo_register_read): Likewise. * rl78-tdep.c (rl78_pseudo_register_read): Likewise. * s390-linux-tdep.c (s390_pseudo_register_read): Likewise. * sparc-tdep.c (sparc32_pseudo_register_read): Likewise. * sparc64-tdep.c (sparc64_pseudo_register_read): Likewise. * spu-tdep.c (spu_pseudo_register_read_spu): Likewise. * xtensa-tdep.c (xtensa_pseudo_register_read): Likewise.
2018-01-22 12:02:49 +01:00
status = regcache->raw_read (double_regnum, reg_buf);
gdb/ * regcache.h (regcache_raw_read, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_signed) (regcache_raw_read_unsigned, regcache_raw_read_part) (regcache_cooked_read, regcache_cooked_read_signed) (regcache_cooked_read_unsigned, regcache_cooked_read_part) (regcache_cooked_read_ftype): Change return to enum register_status. * regcache.c: Include exceptions.h (regcache_save): Adjust to handle REG_UNAVAILABLE registers. (do_cooked_read): Change return to enum register_status. Always forward to regcache_cooked_read. (regcache_raw_read): Change return to enum register_status. If the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_raw_read_signed): Handle non-REG_VALID registers and return the register's status. (regcache_raw_read_unsigned): Ditto. (regcache_cooked_read): Change return to enum register_status. Assert that with read-only regcaches, the register's status must be known. If the regcache is read-only, and the register is not REG_VALID, memset the buffer. Return the register's status. (regcache_cooked_read_signed): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_cooked_read_unsigned): Change return to enum register_status. Handle non-REG_VALID registers and return the register's status. (regcache_xfer_part, regcache_raw_read_part) (regcache_cooked_read_part): Change return to enum register_status. Return the register's status. (regcache_read_pc): Throw NOT_AVAILABLE_ERROR if the register is unavailable. (regcache_dump): Handle unavailable cooked registers. * frame.c (do_frame_register_read): Adjust interface to match regcache_cooked_read_ftype. * gdbarch.sh (pseudo_register_read): Change return to enum register_status. * gdbarch.h, gdbarch.c: Regenerate. * i386-tdep.h (i386_pseudo_register_read): Change return to enum register_status. * i386-tdep.c (i386_pseudo_register_read): Change return to enum register_status. If reading a raw register indicates the raw register is not valid, return the raw register's status, otherwise, return REG_VALID. * amd64-tdep.c (amd64_pseudo_register_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * arm-tdep.c (arm_neon_quad_read) (arm_pseudo_read): Change return to enum register_status. Handle non-REG_VALID raw registers and return the register's status. * avr-tdep.c (avr_pseudo_register_read): Ditto. * frv-tdep.c (frv_pseudo_register_read): Ditto. * h8300-tdep.c (h8300_pseudo_register_read): Ditto. * hppa-tdep.c (hppa_pseudo_register_read): Ditto. * m32c-tdep.c (m32c_move_reg_t): Change return to enum register_status. (m32c_raw_read, m32c_raw_write, m32c_banked_read) (m32c_banked_write, m32c_sb_read, m32c_sb_write, m32c_part_read) (m32c_part_write, m32c_cat_read, m32c_cat_write) (m32c_r3r2r1r0_read, m32c_r3r2r1r0_write) (m32c_pseudo_register_read): Change return to enum register_status. Adjust. * m68hc11-tdep.c (m68hc11_pseudo_register_read): Change return to enum register_status. Return the register's status. * mep-tdep.c (mep_pseudo_cr32_read): Change return to enum register_status. Return the register's status. (mep_pseudo_cr64_read, mep_pseudo_register_read): Ditto. * mips-tdep.c (mips_pseudo_register_read): Ditto. * mt-tdep.c (mt_pseudo_register_read): Ditto. * rs6000-tdep.c (move_ev_register_func): New typedef. (e500_move_ev_register): Use it. Change return to enum register_status. Return the register's status. (do_regcache_raw_read): New function. (do_regcache_raw_write): New function. (e500_pseudo_register_read): Change return to enum register_status. Return the register's status. Use do_regcache_raw_read. (e500_pseudo_register_write): Adjust. Use do_regcache_raw_write. (dfp_pseudo_register_read): Change return to enum register_status. Return the register's status. (vsx_pseudo_register_read): Ditto. (efpr_pseudo_register_read): Ditto. (rs6000_pseudo_register_read): Ditto. * s390-tdep.c (s390_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh64-tdep.c (pseudo_register_read_portions): New function. (sh64_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * ia64-tdep.c (ia64_pseudo_register_read): Change return to enum register_status. Return the register's status. * sh-tdep.c (pseudo_register_read_portions): New function. (sh_pseudo_register_read): Change return to enum register_status. Use pseudo_register_read_portions. Return the register's status. * sparc-tdep.c (sparc32_pseudo_register_read): Change return to enum register_status. Return the register's status. * sparc64-tdep.c (sparc64_pseudo_register_read): Ditto. * spu-tdep.c (spu_pseudo_register_read_spu) (spu_pseudo_register_read): Ditto. * xtensa-tdep.c (xtensa_register_read_masked) (xtensa_pseudo_register_read): Ditto. * bfin-tdep.c (bfin_pseudo_register_read): Ditto.
2011-03-18 19:38:44 +01:00
if (status == REG_VALID)
memcpy (buf, reg_buf + offset, 4);
return status;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
}
}
/* Store the contents of BUF to a NEON quad register, by writing to
two double registers. This is used to implement the quad pseudo
registers, and for argument passing in case the quad registers are
missing; vectors are passed in quad registers when using the VFP
ABI, even if a NEON unit is not present. REGNUM is the index
of the quad register, in [0, 15]. */
static void
arm_neon_quad_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
char name_buf[4];
int offset, double_regnum;
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum << 1);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
/* d0 is always the least significant half of q0. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = 8;
else
offset = 0;
regcache->raw_write (double_regnum, buf + offset);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
offset = 8 - offset;
regcache->raw_write (double_regnum + 1, buf + offset);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
}
static void
arm_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
const int num_regs = gdbarch_num_regs (gdbarch);
char name_buf[4];
gdb_byte reg_buf[8];
int offset, double_regnum;
gdb_assert (regnum >= num_regs);
regnum -= num_regs;
if (gdbarch_tdep (gdbarch)->have_neon_pseudos && regnum >= 32 && regnum < 48)
/* Quad-precision register. */
arm_neon_quad_write (gdbarch, regcache, regnum - 32, buf);
else
{
/* Single-precision register. */
gdb_assert (regnum < 32);
/* s0 is always the least significant half of d0. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
offset = (regnum & 1) ? 0 : 4;
else
offset = (regnum & 1) ? 4 : 0;
xsnprintf (name_buf, sizeof (name_buf), "d%d", regnum >> 1);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
double_regnum = user_reg_map_name_to_regnum (gdbarch, name_buf,
strlen (name_buf));
regcache->raw_read (double_regnum, reg_buf);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
memcpy (reg_buf + offset, buf, 4);
regcache->raw_write (double_regnum, reg_buf);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
}
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
static struct value *
value_of_arm_user_reg (struct frame_info *frame, const void *baton)
{
Add some more casts (1/2) Note: I needed to split this patch in two, otherwise it's too big for the mailing list. This patch adds explicit casts to situations where a void pointer is assigned to a pointer to the "real" type. Building in C++ mode requires those assignments to use an explicit cast. This includes, for example: - callback arguments (cleanups, comparison functions, ...) - data attached to some object (objfile, program space, etc) in the form of a void pointer - "user data" passed to some function This patch comes from the commit "(mostly) auto-generated patch to insert casts needed for C++", taken from Pedro's C++ branch. Only files built on x86 with --enable-targets=all are modified, so the native files for other arches will need to be dealt with separately. I built-tested this with --enable-targets=all and reg-tested. To my surprise, a test case (selftest.exp) had to be adjusted. Here's the ChangeLog entry. Again, this was relatively quick to make despite the length, thanks to David Malcom's script, although I don't believe it's very useful information in that particular case... gdb/ChangeLog: * aarch64-tdep.c (aarch64_make_prologue_cache): Add cast(s). (aarch64_make_stub_cache): Likewise. (value_of_aarch64_user_reg): Likewise. * ada-lang.c (ada_inferior_data_cleanup): Likewise. (get_ada_inferior_data): Likewise. (get_ada_pspace_data): Likewise. (ada_pspace_data_cleanup): Likewise. (ada_complete_symbol_matcher): Likewise. (ada_exc_search_name_matches): Likewise. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. (get_ada_tasks_inferior_data): Likewise. * addrmap.c (addrmap_mutable_foreach_worker): Likewise. (splay_obstack_alloc): Likewise. (splay_obstack_free): Likewise. * alpha-linux-tdep.c (alpha_linux_supply_gregset): Likewise. (alpha_linux_collect_gregset): Likewise. (alpha_linux_supply_fpregset): Likewise. (alpha_linux_collect_fpregset): Likewise. * alpha-mdebug-tdep.c (alpha_mdebug_frame_unwind_cache): Likewise. * alpha-tdep.c (alpha_lds): Likewise. (alpha_sts): Likewise. (alpha_sigtramp_frame_unwind_cache): Likewise. (alpha_heuristic_frame_unwind_cache): Likewise. (alpha_supply_int_regs): Likewise. (alpha_fill_int_regs): Likewise. (alpha_supply_fp_regs): Likewise. (alpha_fill_fp_regs): Likewise. * alphanbsd-tdep.c (alphanbsd_supply_fpregset): Likewise. (alphanbsd_aout_supply_gregset): Likewise. (alphanbsd_supply_gregset): Likewise. * amd64-linux-tdep.c (amd64_linux_init_abi): Likewise. (amd64_x32_linux_init_abi): Likewise. * amd64-nat.c (amd64_supply_native_gregset): Likewise. (amd64_collect_native_gregset): Likewise. * amd64-tdep.c (amd64_frame_cache): Likewise. (amd64_sigtramp_frame_cache): Likewise. (amd64_epilogue_frame_cache): Likewise. (amd64_supply_fxsave): Likewise. (amd64_supply_xsave): Likewise. (amd64_collect_fxsave): Likewise. (amd64_collect_xsave): Likewise. * amd64-windows-tdep.c (amd64_windows_frame_cache): Likewise. * amd64obsd-tdep.c (amd64obsd_trapframe_cache): Likewise. * arm-linux-tdep.c (arm_linux_supply_gregset): Likewise. (arm_linux_collect_gregset): Likewise. (arm_linux_supply_nwfpe): Likewise. (arm_linux_collect_nwfpe): Likewise. (arm_linux_supply_vfp): Likewise. (arm_linux_collect_vfp): Likewise. * arm-tdep.c (arm_find_mapping_symbol): Likewise. (arm_prologue_unwind_stop_reason): Likewise. (arm_prologue_this_id): Likewise. (arm_prologue_prev_register): Likewise. (arm_exidx_data_free): Likewise. (arm_find_exidx_entry): Likewise. (arm_stub_this_id): Likewise. (arm_m_exception_this_id): Likewise. (arm_m_exception_prev_register): Likewise. (arm_normal_frame_base): Likewise. (gdb_print_insn_arm): Likewise. (arm_objfile_data_free): Likewise. (arm_record_special_symbol): Likewise. (value_of_arm_user_reg): Likewise. * armbsd-tdep.c (armbsd_supply_fpregset): Likewise. (armbsd_supply_gregset): Likewise. * auto-load.c (auto_load_pspace_data_cleanup): Likewise. (get_auto_load_pspace_data): Likewise. (hash_loaded_script_entry): Likewise. (eq_loaded_script_entry): Likewise. (clear_section_scripts): Likewise. (collect_matching_scripts): Likewise. * auxv.c (auxv_inferior_data_cleanup): Likewise. (get_auxv_inferior_data): Likewise. * avr-tdep.c (avr_frame_unwind_cache): Likewise. * ax-general.c (do_free_agent_expr_cleanup): Likewise. * bfd-target.c (target_bfd_xfer_partial): Likewise. (target_bfd_xclose): Likewise. (target_bfd_get_section_table): Likewise. * bfin-tdep.c (bfin_frame_cache): Likewise. * block.c (find_block_in_blockvector): Likewise. (call_site_for_pc): Likewise. (block_find_non_opaque_type_preferred): Likewise. * break-catch-sig.c (signal_catchpoint_insert_location): Likewise. (signal_catchpoint_remove_location): Likewise. (signal_catchpoint_breakpoint_hit): Likewise. (signal_catchpoint_print_one): Likewise. (signal_catchpoint_print_mention): Likewise. (signal_catchpoint_print_recreate): Likewise. * break-catch-syscall.c (get_catch_syscall_inferior_data): Likewise. * breakpoint.c (do_cleanup_counted_command_line): Likewise. (bp_location_compare_addrs): Likewise. (get_first_locp_gte_addr): Likewise. (check_tracepoint_command): Likewise. (do_map_commands_command): Likewise. (get_breakpoint_objfile_data): Likewise. (free_breakpoint_probes): Likewise. (do_captured_breakpoint_query): Likewise. (compare_breakpoints): Likewise. (bp_location_compare): Likewise. (bpstat_remove_breakpoint_callback): Likewise. (do_delete_breakpoint_cleanup): Likewise. * bsd-uthread.c (bsd_uthread_set_supply_uthread): Likewise. (bsd_uthread_set_collect_uthread): Likewise. (bsd_uthread_activate): Likewise. (bsd_uthread_fetch_registers): Likewise. (bsd_uthread_store_registers): Likewise. * btrace.c (check_xml_btrace_version): Likewise. (parse_xml_btrace_block): Likewise. (parse_xml_btrace_pt_config_cpu): Likewise. (parse_xml_btrace_pt_raw): Likewise. (parse_xml_btrace_pt): Likewise. (parse_xml_btrace_conf_bts): Likewise. (parse_xml_btrace_conf_pt): Likewise. (do_btrace_data_cleanup): Likewise. * c-typeprint.c (find_typedef_for_canonicalize): Likewise. * charset.c (cleanup_iconv): Likewise. (do_cleanup_iterator): Likewise. * cli-out.c (cli_uiout_dtor): Likewise. (cli_table_begin): Likewise. (cli_table_body): Likewise. (cli_table_end): Likewise. (cli_table_header): Likewise. (cli_begin): Likewise. (cli_end): Likewise. (cli_field_int): Likewise. (cli_field_skip): Likewise. (cli_field_string): Likewise. (cli_field_fmt): Likewise. (cli_spaces): Likewise. (cli_text): Likewise. (cli_message): Likewise. (cli_wrap_hint): Likewise. (cli_flush): Likewise. (cli_redirect): Likewise. (out_field_fmt): Likewise. (field_separator): Likewise. (cli_out_set_stream): Likewise. * cli/cli-cmds.c (compare_symtabs): Likewise. * cli/cli-dump.c (call_dump_func): Likewise. (restore_section_callback): Likewise. * cli/cli-script.c (clear_hook_in_cleanup): Likewise. (do_restore_user_call_depth): Likewise. (do_free_command_lines_cleanup): Likewise. * coff-pe-read.c (get_section_vmas): Likewise. (pe_as16): Likewise. (pe_as32): Likewise. * coffread.c (coff_symfile_read): Likewise. * common/agent.c (agent_look_up_symbols): Likewise. * common/filestuff.c (do_close_cleanup): Likewise. * common/format.c (free_format_pieces_cleanup): Likewise. * common/vec.c (vec_o_reserve): Likewise. * compile/compile-c-support.c (print_one_macro): Likewise. * compile/compile-c-symbols.c (hash_symbol_error): Likewise. (eq_symbol_error): Likewise. (del_symbol_error): Likewise. (error_symbol_once): Likewise. (gcc_convert_symbol): Likewise. (gcc_symbol_address): Likewise. (hash_symname): Likewise. (eq_symname): Likewise. * compile/compile-c-types.c (hash_type_map_instance): Likewise. (eq_type_map_instance): Likewise. (insert_type): Likewise. (convert_type): Likewise. * compile/compile-object-load.c (munmap_listp_free_cleanup): Likewise. (setup_sections): Likewise. (link_hash_table_free): Likewise. (copy_sections): Likewise. * compile/compile-object-run.c (do_module_cleanup): Likewise. * compile/compile.c (compile_print_value): Likewise. (do_rmdir): Likewise. (cleanup_compile_instance): Likewise. (cleanup_unlink_file): Likewise. * completer.c (free_completion_tracker): Likewise. * corelow.c (add_to_spuid_list): Likewise. * cp-namespace.c (reset_directive_searched): Likewise. * cp-support.c (reset_directive_searched): Likewise. * cris-tdep.c (cris_sigtramp_frame_unwind_cache): Likewise. (cris_frame_unwind_cache): Likewise. * d-lang.c (builtin_d_type): Likewise. * d-namespace.c (reset_directive_searched): Likewise. * dbxread.c (dbx_free_symfile_info): Likewise. (do_free_bincl_list_cleanup): Likewise. * disasm.c (hash_dis_line_entry): Likewise. (eq_dis_line_entry): Likewise. (dis_asm_print_address): Likewise. (fprintf_disasm): Likewise. (do_ui_file_delete): Likewise. * doublest.c (convert_floatformat_to_doublest): Likewise. * dummy-frame.c (pop_dummy_frame_bpt): Likewise. (dummy_frame_prev_register): Likewise. (dummy_frame_this_id): Likewise. * dwarf2-frame-tailcall.c (cache_hash): Likewise. (cache_eq): Likewise. (cache_find): Likewise. (tailcall_frame_this_id): Likewise. (dwarf2_tailcall_prev_register_first): Likewise. (tailcall_frame_prev_register): Likewise. (tailcall_frame_dealloc_cache): Likewise. (tailcall_frame_prev_arch): Likewise. * dwarf2-frame.c (dwarf2_frame_state_free): Likewise. (dwarf2_frame_set_init_reg): Likewise. (dwarf2_frame_init_reg): Likewise. (dwarf2_frame_set_signal_frame_p): Likewise. (dwarf2_frame_signal_frame_p): Likewise. (dwarf2_frame_set_adjust_regnum): Likewise. (dwarf2_frame_adjust_regnum): Likewise. (clear_pointer_cleanup): Likewise. (dwarf2_frame_cache): Likewise. (find_cie): Likewise. (dwarf2_frame_find_fde): Likewise. * dwarf2expr.c (dwarf_expr_address_type): Likewise. (free_dwarf_expr_context_cleanup): Likewise. * dwarf2loc.c (locexpr_find_frame_base_location): Likewise. (locexpr_get_frame_base): Likewise. (loclist_find_frame_base_location): Likewise. (loclist_get_frame_base): Likewise. (dwarf_expr_dwarf_call): Likewise. (dwarf_expr_get_base_type): Likewise. (dwarf_expr_push_dwarf_reg_entry_value): Likewise. (dwarf_expr_get_obj_addr): Likewise. (entry_data_value_coerce_ref): Likewise. (entry_data_value_copy_closure): Likewise. (entry_data_value_free_closure): Likewise. (get_frame_address_in_block_wrapper): Likewise. (dwarf2_evaluate_property): Likewise. (dwarf2_compile_property_to_c): Likewise. (needs_frame_read_addr_from_reg): Likewise. (needs_frame_get_reg_value): Likewise. (needs_frame_frame_base): Likewise. (needs_frame_frame_cfa): Likewise. (needs_frame_tls_address): Likewise. (needs_frame_dwarf_call): Likewise. (needs_dwarf_reg_entry_value): Likewise. (get_ax_pc): Likewise. (locexpr_read_variable): Likewise. (locexpr_read_variable_at_entry): Likewise. (locexpr_read_needs_frame): Likewise. (locexpr_describe_location): Likewise. (locexpr_tracepoint_var_ref): Likewise. (locexpr_generate_c_location): Likewise. (loclist_read_variable): Likewise. (loclist_read_variable_at_entry): Likewise. (loclist_describe_location): Likewise. (loclist_tracepoint_var_ref): Likewise. (loclist_generate_c_location): Likewise. * dwarf2read.c (line_header_hash_voidp): Likewise. (line_header_eq_voidp): Likewise. (dwarf2_has_info): Likewise. (dwarf2_get_section_info): Likewise. (locate_dwz_sections): Likewise. (hash_file_name_entry): Likewise. (eq_file_name_entry): Likewise. (delete_file_name_entry): Likewise. (dw2_setup): Likewise. (dw2_get_file_names_reader): Likewise. (dw2_find_pc_sect_compunit_symtab): Likewise. (hash_signatured_type): Likewise. (eq_signatured_type): Likewise. (add_signatured_type_cu_to_table): Likewise. (create_debug_types_hash_table): Likewise. (lookup_dwo_signatured_type): Likewise. (lookup_dwp_signatured_type): Likewise. (lookup_signatured_type): Likewise. (hash_type_unit_group): Likewise. (eq_type_unit_group): Likewise. (get_type_unit_group): Likewise. (process_psymtab_comp_unit_reader): Likewise. (sort_tu_by_abbrev_offset): Likewise. (process_skeletonless_type_unit): Likewise. (psymtabs_addrmap_cleanup): Likewise. (dwarf2_read_symtab): Likewise. (psymtab_to_symtab_1): Likewise. (die_hash): Likewise. (die_eq): Likewise. (load_full_comp_unit_reader): Likewise. (reset_die_in_process): Likewise. (free_cu_line_header): Likewise. (handle_DW_AT_stmt_list): Likewise. (hash_dwo_file): Likewise. (eq_dwo_file): Likewise. (hash_dwo_unit): Likewise. (eq_dwo_unit): Likewise. (create_dwo_cu_reader): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (lookup_dwo_unit_in_dwp): Likewise. (dwarf2_locate_dwo_sections): Likewise. (dwarf2_locate_common_dwp_sections): Likewise. (dwarf2_locate_v2_dwp_sections): Likewise. (hash_dwp_loaded_cutus): Likewise. (eq_dwp_loaded_cutus): Likewise. (lookup_dwo_cutu): Likewise. (abbrev_table_free_cleanup): Likewise. (dwarf2_free_abbrev_table): Likewise. (find_partial_die_in_comp_unit): Likewise. (free_line_header_voidp): Likewise. (follow_die_offset): Likewise. (follow_die_sig_1): Likewise. (free_heap_comp_unit): Likewise. (free_stack_comp_unit): Likewise. (dwarf2_free_objfile): Likewise. (per_cu_offset_and_type_hash): Likewise. (per_cu_offset_and_type_eq): Likewise. (get_die_type_at_offset): Likewise. (partial_die_hash): Likewise. (partial_die_eq): Likewise. (dwarf2_per_objfile_free): Likewise. (hash_strtab_entry): Likewise. (eq_strtab_entry): Likewise. (add_string): Likewise. (hash_symtab_entry): Likewise. (eq_symtab_entry): Likewise. (delete_symtab_entry): Likewise. (cleanup_mapped_symtab): Likewise. (add_indices_to_cpool): Likewise. (hash_psymtab_cu_index): Likewise. (eq_psymtab_cu_index): Likewise. (add_address_entry_worker): Likewise. (unlink_if_set): Likewise. (write_one_signatured_type): Likewise. (save_gdb_index_command): Likewise. * elfread.c (elf_symtab_read): Likewise. (elf_gnu_ifunc_cache_hash): Likewise. (elf_gnu_ifunc_cache_eq): Likewise. (elf_gnu_ifunc_record_cache): Likewise. (elf_gnu_ifunc_resolve_by_cache): Likewise. (elf_get_probes): Likewise. (probe_key_free): Likewise. * f-lang.c (builtin_f_type): Likewise. * frame-base.c (frame_base_append_sniffer): Likewise. (frame_base_set_default): Likewise. (frame_base_find_by_frame): Likewise. * frame-unwind.c (frame_unwind_prepend_unwinder): Likewise. (frame_unwind_append_unwinder): Likewise. (frame_unwind_find_by_frame): Likewise. * frame.c (frame_addr_hash): Likewise. (frame_addr_hash_eq): Likewise. (frame_stash_find): Likewise. (do_frame_register_read): Likewise. (unwind_to_current_frame): Likewise. (frame_cleanup_after_sniffer): Likewise. * frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise. * frv-tdep.c (frv_frame_unwind_cache): Likewise. * ft32-tdep.c (ft32_frame_cache): Likewise. * gcore.c (do_bfd_delete_cleanup): Likewise. (gcore_create_callback): Likewise. * gdb_bfd.c (hash_bfd): Likewise. (eq_bfd): Likewise. (gdb_bfd_open): Likewise. (free_one_bfd_section): Likewise. (gdb_bfd_ref): Likewise. (gdb_bfd_unref): Likewise. (get_section_descriptor): Likewise. (gdb_bfd_map_section): Likewise. (gdb_bfd_crc): Likewise. (gdb_bfd_mark_parent): Likewise. (gdb_bfd_record_inclusion): Likewise. (gdb_bfd_requires_relocations): Likewise. (print_one_bfd): Likewise. * gdbtypes.c (type_pair_hash): Likewise. (type_pair_eq): Likewise. (builtin_type): Likewise. (objfile_type): Likewise. * gnu-v3-abi.c (vtable_ptrdiff_type): Likewise. (vtable_address_point_offset): Likewise. (gnuv3_get_vtable): Likewise. (hash_value_and_voffset): Likewise. (eq_value_and_voffset): Likewise. (compare_value_and_voffset): Likewise. (compute_vtable_size): Likewise. (gnuv3_get_typeid_type): Likewise. * go-lang.c (builtin_go_type): Likewise. * guile/scm-block.c (bkscm_hash_block_smob): Likewise. (bkscm_eq_block_smob): Likewise. (bkscm_objfile_block_map): Likewise. (bkscm_del_objfile_blocks): Likewise. * guile/scm-breakpoint.c (bpscm_build_bp_list): Likewise. * guile/scm-disasm.c (gdbscm_disasm_read_memory_worker): Likewise. (gdbscm_disasm_print_address): Likewise. * guile/scm-frame.c (frscm_hash_frame_smob): Likewise. (frscm_eq_frame_smob): Likewise. (frscm_inferior_frame_map): Likewise. (frscm_del_inferior_frames): Likewise. * guile/scm-gsmob.c (gdbscm_add_objfile_ref): Likewise. * guile/scm-objfile.c (ofscm_handle_objfile_deleted): Likewise. (ofscm_objfile_smob_from_objfile): Likewise. * guile/scm-ports.c (ioscm_write): Likewise. (ioscm_file_port_delete): Likewise. (ioscm_file_port_rewind): Likewise. (ioscm_file_port_put): Likewise. (ioscm_file_port_write): Likewise. * guile/scm-progspace.c (psscm_handle_pspace_deleted): Likewise. (psscm_pspace_smob_from_pspace): Likewise. * guile/scm-safe-call.c (scscm_recording_pre_unwind_handler): Likewise. (scscm_recording_unwind_handler): Likewise. (gdbscm_with_catch): Likewise. (scscm_call_0_body): Likewise. (scscm_call_1_body): Likewise. (scscm_call_2_body): Likewise. (scscm_call_3_body): Likewise. (scscm_call_4_body): Likewise. (scscm_apply_1_body): Likewise. (scscm_eval_scheme_string): Likewise. (gdbscm_safe_eval_string): Likewise. (scscm_source_scheme_script): Likewise. (gdbscm_safe_source_script): Likewise. * guile/scm-string.c (gdbscm_call_scm_to_stringn): Likewise. (gdbscm_call_scm_from_stringn): Likewise. * guile/scm-symbol.c (syscm_hash_symbol_smob): Likewise. (syscm_eq_symbol_smob): Likewise. (syscm_get_symbol_map): Likewise. (syscm_del_objfile_symbols): Likewise. * guile/scm-symtab.c (stscm_hash_symtab_smob): Likewise. (stscm_eq_symtab_smob): Likewise. (stscm_objfile_symtab_map): Likewise. (stscm_del_objfile_symtabs): Likewise. * guile/scm-type.c (tyscm_hash_type_smob): Likewise. (tyscm_eq_type_smob): Likewise. (tyscm_type_map): Likewise. (tyscm_copy_type_recursive): Likewise. (save_objfile_types): Likewise. * guile/scm-utils.c (extract_arg): Likewise. * h8300-tdep.c (h8300_frame_cache): Likewise. * hppa-linux-tdep.c (hppa_linux_sigtramp_frame_unwind_cache): Likewise. * hppa-tdep.c (compare_unwind_entries): Likewise. (find_unwind_entry): Likewise. (hppa_frame_cache): Likewise. (hppa_stub_frame_unwind_cache): Likewise. * hppanbsd-tdep.c (hppanbsd_supply_gregset): Likewise. * hppaobsd-tdep.c (hppaobsd_supply_gregset): Likewise. (hppaobsd_supply_fpregset): Likewise. * i386-cygwin-tdep.c (core_process_module_section): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Likewise. * i386-tdep.c (i386_frame_cache): Likewise. (i386_epilogue_frame_cache): Likewise. (i386_sigtramp_frame_cache): Likewise. (i386_supply_gregset): Likewise. (i386_collect_gregset): Likewise. (i386_gdbarch_init): Likewise. * i386obsd-tdep.c (i386obsd_aout_supply_regset): Likewise. (i386obsd_trapframe_cache): Likewise. * i387-tdep.c (i387_supply_fsave): Likewise. (i387_collect_fsave): Likewise. (i387_supply_fxsave): Likewise. (i387_collect_fxsave): Likewise. (i387_supply_xsave): Likewise. (i387_collect_xsave): Likewise. * ia64-tdep.c (ia64_frame_cache): Likewise. (ia64_sigtramp_frame_cache): Likewise. * infcmd.c (attach_command_continuation): Likewise. (attach_command_continuation_free_args): Likewise. * inferior.c (restore_inferior): Likewise. (delete_thread_of_inferior): Likewise. * inflow.c (inflow_inferior_data_cleanup): Likewise. (get_inflow_inferior_data): Likewise. (inflow_inferior_exit): Likewise. * infrun.c (displaced_step_clear_cleanup): Likewise. (restore_current_uiout_cleanup): Likewise. (release_stop_context_cleanup): Likewise. (do_restore_infcall_suspend_state_cleanup): Likewise. (do_restore_infcall_control_state_cleanup): Likewise. (restore_inferior_ptid): Likewise. * inline-frame.c (block_starting_point_at): Likewise. * iq2000-tdep.c (iq2000_frame_cache): Likewise. * jit.c (get_jit_objfile_data): Likewise. (get_jit_program_space_data): Likewise. (jit_object_close_impl): Likewise. (jit_find_objf_with_entry_addr): Likewise. (jit_breakpoint_deleted): Likewise. (jit_unwind_reg_set_impl): Likewise. (jit_unwind_reg_get_impl): Likewise. (jit_dealloc_cache): Likewise. (jit_frame_sniffer): Likewise. (jit_frame_prev_register): Likewise. (jit_prepend_unwinder): Likewise. (jit_inferior_exit_hook): Likewise. (free_objfile_data): Likewise. * jv-lang.c (jv_per_objfile_free): Likewise. (get_dynamics_objfile): Likewise. (get_java_class_symtab): Likewise. (builtin_java_type): Likewise. * language.c (language_string_char_type): Likewise. (language_bool_type): Likewise. (language_lookup_primitive_type): Likewise. (language_lookup_primitive_type_as_symbol): Likewise. * linespec.c (hash_address_entry): Likewise. (eq_address_entry): Likewise. (iterate_inline_only): Likewise. (iterate_name_matcher): Likewise. (decode_line_2_compare_items): Likewise. (collect_one_symbol): Likewise. (compare_symbols): Likewise. (compare_msymbols): Likewise. (add_symtabs_to_list): Likewise. (collect_symbols): Likewise. (compare_msyms): Likewise. (add_minsym): Likewise. (cleanup_linespec_result): Likewise. * linux-fork.c (inferior_call_waitpid_cleanup): Likewise. * linux-nat.c (delete_lwp_cleanup): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (resume_stopped_resumed_lwps): Likewise. * linux-tdep.c (get_linux_gdbarch_data): Likewise. (invalidate_linux_cache_inf): Likewise. (get_linux_inferior_data): Likewise. (linux_find_memory_regions_thunk): Likewise. (linux_make_mappings_callback): Likewise. (linux_corefile_thread_callback): Likewise. (find_mapping_size): Likewise. * linux-thread-db.c (find_new_threads_callback): Likewise. * lm32-tdep.c (lm32_frame_cache): Likewise. * m2-lang.c (builtin_m2_type): Likewise. * m32c-tdep.c (m32c_analyze_frame_prologue): Likewise. * m32r-linux-tdep.c (m32r_linux_sigtramp_frame_cache): Likewise. (m32r_linux_supply_gregset): Likewise. (m32r_linux_collect_gregset): Likewise. * m32r-tdep.c (m32r_frame_unwind_cache): Likewise. * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Likewise. * m68k-tdep.c (m68k_frame_cache): Likewise. * m68kbsd-tdep.c (m68kbsd_supply_fpregset): Likewise. (m68kbsd_supply_gregset): Likewise. * m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise. * m88k-tdep.c (m88k_frame_cache): Likewise. (m88k_supply_gregset): Likewise. gdb/gdbserver/ChangeLog: * dll.c (match_dll): Add cast(s). (unloaded_dll): Likewise. * linux-low.c (second_thread_of_pid_p): Likewise. (delete_lwp_callback): Likewise. (count_events_callback): Likewise. (select_event_lwp_callback): Likewise. (linux_set_resume_request): Likewise. * server.c (accumulate_file_name_length): Likewise. (emit_dll_description): Likewise. (handle_qxfer_threads_worker): Likewise. (visit_actioned_threads): Likewise. * thread-db.c (any_thread_of): Likewise. * tracepoint.c (same_process_p): Likewise. (match_blocktype): Likewise. (build_traceframe_info_xml): Likewise. gdb/testsuite/ChangeLog: * gdb.gdb/selftest.exp (do_steps_and_nexts): Adjust expected source line.
2015-09-25 20:08:07 +02:00
const int *reg_p = (const int *) baton;
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
return value_of_register (*reg_p, frame);
}
* Makefile.in (SFILES): Add osabi.c. (COMMON_OBS): Add osabi.o. (osabi.o): New dependency list. * osabi.c: New file. * osabi.h: New file. * doc/gdbint.texinfo: Document new generic OS ABI framework. * Makefile.in (alpha_tdep_h): Define and use instead of alpha-tdep.h. * alpha-tdep.c (alpha_abi_names, process_note_abi_tag_sections, get_elfosabi, alpha_abi_handler_list, alpha_gdbarch_register_os_abi): Remove. (alpha_gdbarch_init, alpha_dump_tdep): Use generic OS ABI framework. * alpha-tdep.h: Include osabi.h. (alpha_abi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Use gdbarch_register_osabi. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise. * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise. * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise. * Makefile.in (sh_tdep_h): Add osabi.h. * sh-tdep.h (sh_osabi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * sh-tdep.c (sh_osabi_names, process_note_abi_tag_sections, sh_osabi_handler_list, sh_gdbarch_register_os_abi): Remove. (sh_gdbarch_init, sh_dump_tdep): Use generic OS ABI framework. * shnbsd-tdep.c (_initialize_shnbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (arm_tdep_h): Define and use instead of arm-tdep.h. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Use gdbarch_register_osabi. * arm-tdep.c (arm_abi_names, process_note_abi_tag_sections, arm_abi_handler_list, arm_gdbarch_register_os_abi): Remove. (get_elfosabi): Rename to... (arm_elf_osabi_sniffer): ...this. Adjust to use generic OS ABI framework support routines. (arm_gdbarch_init): Use generic OS ABI framework. (arm_dump_tdep): Likewise. (_initialize_arm_tdep): Likewise. * arm-tdep.h: Include osabi.h. (arm_abi): Remove. (gdbarch_tdep): Remove arm_abi and abi_name members. Add osabi member. (arm_gdbarch_register_os_abi): Remove prototype. * armnbsd-tdep.c (arm_netbsd_aout_osabi_sniffer): New function. (_initialize_arm_netbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (mips-tdep.o): Add osabi.h to dependency list. * mips-tdep.c: Include osabi.h. (gdbarch_tdep, mips_gdbarch_init, mips_dump_tdep): Use generic OS ABI framework.
2002-05-21 17:36:03 +02:00
static enum gdb_osabi
arm_elf_osabi_sniffer (bfd *abfd)
{
unsigned int elfosabi;
* Makefile.in (SFILES): Add osabi.c. (COMMON_OBS): Add osabi.o. (osabi.o): New dependency list. * osabi.c: New file. * osabi.h: New file. * doc/gdbint.texinfo: Document new generic OS ABI framework. * Makefile.in (alpha_tdep_h): Define and use instead of alpha-tdep.h. * alpha-tdep.c (alpha_abi_names, process_note_abi_tag_sections, get_elfosabi, alpha_abi_handler_list, alpha_gdbarch_register_os_abi): Remove. (alpha_gdbarch_init, alpha_dump_tdep): Use generic OS ABI framework. * alpha-tdep.h: Include osabi.h. (alpha_abi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Use gdbarch_register_osabi. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise. * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise. * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise. * Makefile.in (sh_tdep_h): Add osabi.h. * sh-tdep.h (sh_osabi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * sh-tdep.c (sh_osabi_names, process_note_abi_tag_sections, sh_osabi_handler_list, sh_gdbarch_register_os_abi): Remove. (sh_gdbarch_init, sh_dump_tdep): Use generic OS ABI framework. * shnbsd-tdep.c (_initialize_shnbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (arm_tdep_h): Define and use instead of arm-tdep.h. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Use gdbarch_register_osabi. * arm-tdep.c (arm_abi_names, process_note_abi_tag_sections, arm_abi_handler_list, arm_gdbarch_register_os_abi): Remove. (get_elfosabi): Rename to... (arm_elf_osabi_sniffer): ...this. Adjust to use generic OS ABI framework support routines. (arm_gdbarch_init): Use generic OS ABI framework. (arm_dump_tdep): Likewise. (_initialize_arm_tdep): Likewise. * arm-tdep.h: Include osabi.h. (arm_abi): Remove. (gdbarch_tdep): Remove arm_abi and abi_name members. Add osabi member. (arm_gdbarch_register_os_abi): Remove prototype. * armnbsd-tdep.c (arm_netbsd_aout_osabi_sniffer): New function. (_initialize_arm_netbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (mips-tdep.o): Add osabi.h to dependency list. * mips-tdep.c: Include osabi.h. (gdbarch_tdep, mips_gdbarch_init, mips_dump_tdep): Use generic OS ABI framework.
2002-05-21 17:36:03 +02:00
enum gdb_osabi osabi = GDB_OSABI_UNKNOWN;
* Makefile.in (SFILES): Add osabi.c. (COMMON_OBS): Add osabi.o. (osabi.o): New dependency list. * osabi.c: New file. * osabi.h: New file. * doc/gdbint.texinfo: Document new generic OS ABI framework. * Makefile.in (alpha_tdep_h): Define and use instead of alpha-tdep.h. * alpha-tdep.c (alpha_abi_names, process_note_abi_tag_sections, get_elfosabi, alpha_abi_handler_list, alpha_gdbarch_register_os_abi): Remove. (alpha_gdbarch_init, alpha_dump_tdep): Use generic OS ABI framework. * alpha-tdep.h: Include osabi.h. (alpha_abi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Use gdbarch_register_osabi. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise. * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise. * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise. * Makefile.in (sh_tdep_h): Add osabi.h. * sh-tdep.h (sh_osabi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * sh-tdep.c (sh_osabi_names, process_note_abi_tag_sections, sh_osabi_handler_list, sh_gdbarch_register_os_abi): Remove. (sh_gdbarch_init, sh_dump_tdep): Use generic OS ABI framework. * shnbsd-tdep.c (_initialize_shnbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (arm_tdep_h): Define and use instead of arm-tdep.h. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Use gdbarch_register_osabi. * arm-tdep.c (arm_abi_names, process_note_abi_tag_sections, arm_abi_handler_list, arm_gdbarch_register_os_abi): Remove. (get_elfosabi): Rename to... (arm_elf_osabi_sniffer): ...this. Adjust to use generic OS ABI framework support routines. (arm_gdbarch_init): Use generic OS ABI framework. (arm_dump_tdep): Likewise. (_initialize_arm_tdep): Likewise. * arm-tdep.h: Include osabi.h. (arm_abi): Remove. (gdbarch_tdep): Remove arm_abi and abi_name members. Add osabi member. (arm_gdbarch_register_os_abi): Remove prototype. * armnbsd-tdep.c (arm_netbsd_aout_osabi_sniffer): New function. (_initialize_arm_netbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (mips-tdep.o): Add osabi.h to dependency list. * mips-tdep.c: Include osabi.h. (gdbarch_tdep, mips_gdbarch_init, mips_dump_tdep): Use generic OS ABI framework.
2002-05-21 17:36:03 +02:00
elfosabi = elf_elfheader (abfd)->e_ident[EI_OSABI];
if (elfosabi == ELFOSABI_ARM)
/* GNU tools use this value. Check note sections in this case,
as well. */
bfd_map_over_sections (abfd,
generic_elf_osabi_sniff_abi_tag_sections,
&osabi);
/* Anything else will be handled by the generic ELF sniffer. */
* Makefile.in (SFILES): Add osabi.c. (COMMON_OBS): Add osabi.o. (osabi.o): New dependency list. * osabi.c: New file. * osabi.h: New file. * doc/gdbint.texinfo: Document new generic OS ABI framework. * Makefile.in (alpha_tdep_h): Define and use instead of alpha-tdep.h. * alpha-tdep.c (alpha_abi_names, process_note_abi_tag_sections, get_elfosabi, alpha_abi_handler_list, alpha_gdbarch_register_os_abi): Remove. (alpha_gdbarch_init, alpha_dump_tdep): Use generic OS ABI framework. * alpha-tdep.h: Include osabi.h. (alpha_abi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Use gdbarch_register_osabi. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise. * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise. * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise. * Makefile.in (sh_tdep_h): Add osabi.h. * sh-tdep.h (sh_osabi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * sh-tdep.c (sh_osabi_names, process_note_abi_tag_sections, sh_osabi_handler_list, sh_gdbarch_register_os_abi): Remove. (sh_gdbarch_init, sh_dump_tdep): Use generic OS ABI framework. * shnbsd-tdep.c (_initialize_shnbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (arm_tdep_h): Define and use instead of arm-tdep.h. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Use gdbarch_register_osabi. * arm-tdep.c (arm_abi_names, process_note_abi_tag_sections, arm_abi_handler_list, arm_gdbarch_register_os_abi): Remove. (get_elfosabi): Rename to... (arm_elf_osabi_sniffer): ...this. Adjust to use generic OS ABI framework support routines. (arm_gdbarch_init): Use generic OS ABI framework. (arm_dump_tdep): Likewise. (_initialize_arm_tdep): Likewise. * arm-tdep.h: Include osabi.h. (arm_abi): Remove. (gdbarch_tdep): Remove arm_abi and abi_name members. Add osabi member. (arm_gdbarch_register_os_abi): Remove prototype. * armnbsd-tdep.c (arm_netbsd_aout_osabi_sniffer): New function. (_initialize_arm_netbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (mips-tdep.o): Add osabi.h to dependency list. * mips-tdep.c: Include osabi.h. (gdbarch_tdep, mips_gdbarch_init, mips_dump_tdep): Use generic OS ABI framework.
2002-05-21 17:36:03 +02:00
return osabi;
}
static int
arm_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
/* FPS register's type is INT, but belongs to float_reggroup. Beside
this, FPS register belongs to save_regroup, restore_reggroup, and
all_reggroup, of course. */
if (regnum == ARM_FPS_REGNUM)
return (group == float_reggroup
|| group == save_reggroup
|| group == restore_reggroup
|| group == all_reggroup);
else
return default_register_reggroup_p (gdbarch, regnum, group);
}
/* For backward-compatibility we allow two 'g' packet lengths with
the remote protocol depending on whether FPA registers are
supplied. M-profile targets do not have FPA registers, but some
stubs already exist in the wild which use a 'g' packet which
supplies them albeit with dummy values. The packet format which
includes FPA registers should be considered deprecated for
M-profile targets. */
static void
arm_register_g_packet_guesses (struct gdbarch *gdbarch)
{
if (gdbarch_tdep (gdbarch)->is_m)
{
const target_desc *tdesc;
/* If we know from the executable this is an M-profile target,
cater for remote targets whose register set layout is the
same as the FPA layout. */
tdesc = arm_read_mprofile_description (ARM_M_TYPE_WITH_FPA);
register_remote_g_packet_guess (gdbarch,
ARM_CORE_REGS_SIZE + ARM_FP_REGS_SIZE,
tdesc);
/* The regular M-profile layout. */
tdesc = arm_read_mprofile_description (ARM_M_TYPE_M_PROFILE);
register_remote_g_packet_guess (gdbarch, ARM_CORE_REGS_SIZE,
tdesc);
/* M-profile plus M4F VFP. */
tdesc = arm_read_mprofile_description (ARM_M_TYPE_VFP_D16);
register_remote_g_packet_guess (gdbarch,
ARM_CORE_REGS_SIZE + ARM_VFP2_REGS_SIZE,
tdesc);
}
/* Otherwise we don't have a useful guess. */
}
Skip unwritable frames in command "finish" Nowadays, GDB can't insert breakpoint on the return address of the exception handler on ARM M-profile, because the address is a magic one 0xfffffff9, (gdb) bt #0 CT32B1_IRQHandler () at ../src/timer.c:67 #1 <signal handler called> #2 main () at ../src/timer.c:127 (gdb) info frame Stack level 0, frame at 0x200ffa8: pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9 called by frame at 0x200ffc8 source language c. Arglist at 0x200ffa0, args: Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8 Saved registers: r7 at 0x200ffa0, lr at 0x200ffa4 (gdb) x/x 0xfffffff9 0xfffffff9: Cannot access memory at address 0xfffffff9 (gdb) finish Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67 Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?) Warning: Cannot insert hardware breakpoint 0. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. Command aborted. even some debug probe can't set hardware breakpoint on the magic address too, (gdb) hbreak *0xfffffff9 Hardware assisted breakpoint 2 at 0xfffffff9 (gdb) c Continuing. Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?) Warning: Cannot insert hardware breakpoint 2. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. Command aborted. The problem described above is quite similar to PR 8841, in which GDB can't set breakpoint on signal trampoline, which is mapped to a read-only page by kernel. The rationale of this patch is to skip "unwritable" frames when looking for caller frames in command "finish", and a new gdbarch method code_of_frame_writable is added. This patch fixes the problem on ARM cortex-m target, but it can be used to fix PR 8841 too. gdb: 2016-05-10 Yao Qi <yao.qi@arm.com> * arch-utils.c (default_code_of_frame_writable): New function. * arch-utils.h (default_code_of_frame_writable): Declare. * arm-tdep.c (arm_code_of_frame_writable): New function. (arm_gdbarch_init): Install gdbarch method code_of_frame_writable if the target is M-profile. * frame.c (skip_unwritable_frames): New function. * frame.h (skip_unwritable_frames): Declare. * gdbarch.sh (code_of_frame_writable): New. * gdbarch.c, gdbarch.h: Re-generated. * infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 18:32:56 +02:00
/* Implement the code_of_frame_writable gdbarch method. */
static int
arm_code_of_frame_writable (struct gdbarch *gdbarch, struct frame_info *frame)
{
if (gdbarch_tdep (gdbarch)->is_m
&& get_frame_type (frame) == SIGTRAMP_FRAME)
{
/* M-profile exception frames return to some magic PCs, where
isn't writable at all. */
return 0;
}
else
return 1;
}
/* Implement gdbarch_gnu_triplet_regexp. If the arch name is arm then allow it
to be postfixed by a version (eg armv7hl). */
static const char *
arm_gnu_triplet_regexp (struct gdbarch *gdbarch)
{
if (strcmp (gdbarch_bfd_arch_info (gdbarch)->arch_name, "arm") == 0)
return "arm(v[^- ]*)?";
return gdbarch_bfd_arch_info (gdbarch)->arch_name;
}
/* Initialize the current architecture based on INFO. If possible,
re-use an architecture from ARCHES, which is a list of
architectures already created during this debugging session.
Called e.g. at program startup, when reading a core file, and when
reading a binary file. */
static struct gdbarch *
arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
struct gdbarch_tdep *tdep;
struct gdbarch *gdbarch;
struct gdbarch_list *best_arch;
enum arm_abi_kind arm_abi = arm_abi_global;
enum arm_float_model fp_model = arm_fp_model;
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
struct tdesc_arch_data *tdesc_data = NULL;
int i;
bool is_m = false;
int vfp_register_count = 0;
bool have_vfp_pseudos = false, have_neon_pseudos = false;
bool have_wmmx_registers = false;
bool have_neon = false;
bool have_fpa_registers = true;
const struct target_desc *tdesc = info.target_desc;
/* If we have an object to base this architecture on, try to determine
its ABI. */
if (arm_abi == ARM_ABI_AUTO && info.abfd != NULL)
{
int ei_osabi, e_flags;
switch (bfd_get_flavour (info.abfd))
{
case bfd_target_coff_flavour:
/* Assume it's an old APCS-style ABI. */
/* XXX WinCE? */
arm_abi = ARM_ABI_APCS;
break;
case bfd_target_elf_flavour:
ei_osabi = elf_elfheader (info.abfd)->e_ident[EI_OSABI];
e_flags = elf_elfheader (info.abfd)->e_flags;
if (ei_osabi == ELFOSABI_ARM)
{
/* GNU tools used to use this value, but do not for EABI
objects. There's nowhere to tag an EABI version
anyway, so assume APCS. */
arm_abi = ARM_ABI_APCS;
}
else if (ei_osabi == ELFOSABI_NONE || ei_osabi == ELFOSABI_GNU)
{
int eabi_ver = EF_ARM_EABI_VERSION (e_flags);
switch (eabi_ver)
{
case EF_ARM_EABI_UNKNOWN:
/* Assume GNU tools. */
arm_abi = ARM_ABI_APCS;
break;
case EF_ARM_EABI_VER4:
case EF_ARM_EABI_VER5:
arm_abi = ARM_ABI_AAPCS;
/* EABI binaries default to VFP float ordering.
They may also contain build attributes that can
be used to identify if the VFP argument-passing
ABI is in use. */
if (fp_model == ARM_FLOAT_AUTO)
{
#ifdef HAVE_ELF
switch (bfd_elf_get_obj_attr_int (info.abfd,
OBJ_ATTR_PROC,
Tag_ABI_VFP_args))
{
case AEABI_VFP_args_base:
/* "The user intended FP parameter/result
passing to conform to AAPCS, base
variant". */
fp_model = ARM_FLOAT_SOFT_VFP;
break;
case AEABI_VFP_args_vfp:
/* "The user intended FP parameter/result
passing to conform to AAPCS, VFP
variant". */
fp_model = ARM_FLOAT_VFP;
break;
case AEABI_VFP_args_toolchain:
/* "The user intended FP parameter/result
passing to conform to tool chain-specific
conventions" - we don't know any such
conventions, so leave it as "auto". */
break;
case AEABI_VFP_args_compatible:
ARM: Add support for value 3 of Tag_ABI_VFP_args attribute *** bfd/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new Tag_ABI_VFP_args value and replace hardcoded values by enum values. (elf32_arm_post_process_headers): Set e_flags in ELF header as hard float only when Tag_ABI_VFP_args is 1, using new enum value AEABI_VFP_args_vfp to check that. *** binutils/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible". *** gdb/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm-tdep.c (arm_gdbarch_init): Explicitely handle value 3 of Tag_ABI_VFP_args. Also replace hardcoded values by enum values in the switch handling the different values of Tag_ABI_VFP_args. *** gold/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header as hard float only when Tag_ABI_VFP_args is 1, using new enum value AEABI_VFP_args_vfp to check that. (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args value and replace hardcoded values by enum values. *** include/elf/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum values. *** ld/testsuite/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * ld-arm/attr-merge-2a.s: Add Tag_ABI_VFP_args. * ld-arm/attr-merge-2b.s: Likewise. * ld-arm/attr-merge-2.attr: Likewise. * ld-arm/attr-merge-4a.s: Add Tag_ABI_FP_number_model and Tag_ABI_VFP_args. * ld-arm/attr-merge-4b.s: Likewise. * ld-arm/attr-merge-4.attr: Likewise. * ld-arm/attr-merge-6a.s: Likewise. * ld-arm/attr-merge-6b.s: Likewise. * ld-arm/attr-merge-6.attr: Add Tag_ABI_FP_number_model.
2014-12-25 02:50:48 +01:00
/* "Code is compatible with both the base
and VFP variants; the user did not permit
non-variadic functions to pass FP
parameters/results" - leave it as
"auto". */
break;
default:
/* Attribute value not mentioned in the
ARM: Add support for value 3 of Tag_ABI_VFP_args attribute *** bfd/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new Tag_ABI_VFP_args value and replace hardcoded values by enum values. (elf32_arm_post_process_headers): Set e_flags in ELF header as hard float only when Tag_ABI_VFP_args is 1, using new enum value AEABI_VFP_args_vfp to check that. *** binutils/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible". *** gdb/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm-tdep.c (arm_gdbarch_init): Explicitely handle value 3 of Tag_ABI_VFP_args. Also replace hardcoded values by enum values in the switch handling the different values of Tag_ABI_VFP_args. *** gold/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header as hard float only when Tag_ABI_VFP_args is 1, using new enum value AEABI_VFP_args_vfp to check that. (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args value and replace hardcoded values by enum values. *** include/elf/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * arm.h: New AEABI_FP_number_model_* and AEABI_VFP_args_* enum values. *** ld/testsuite/ChangeLog *** 2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com> * ld-arm/attr-merge-2a.s: Add Tag_ABI_VFP_args. * ld-arm/attr-merge-2b.s: Likewise. * ld-arm/attr-merge-2.attr: Likewise. * ld-arm/attr-merge-4a.s: Add Tag_ABI_FP_number_model and Tag_ABI_VFP_args. * ld-arm/attr-merge-4b.s: Likewise. * ld-arm/attr-merge-4.attr: Likewise. * ld-arm/attr-merge-6a.s: Likewise. * ld-arm/attr-merge-6b.s: Likewise. * ld-arm/attr-merge-6.attr: Add Tag_ABI_FP_number_model.
2014-12-25 02:50:48 +01:00
November 2012 ABI, so leave it as
"auto". */
break;
}
#else
fp_model = ARM_FLOAT_SOFT_VFP;
#endif
}
break;
default:
/* Leave it as "auto". */
warning (_("unknown ARM EABI version 0x%x"), eabi_ver);
break;
}
#ifdef HAVE_ELF
/* Detect M-profile programs. This only works if the
executable file includes build attributes; GCC does
copy them to the executable, but e.g. RealView does
not. */
int attr_arch
= bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
Tag_CPU_arch);
int attr_profile
= bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_PROC,
Tag_CPU_arch_profile);
/* GCC specifies the profile for v6-M; RealView only
specifies the profile for architectures starting with
V7 (as opposed to architectures with a tag
numerically greater than TAG_CPU_ARCH_V7). */
if (!tdesc_has_registers (tdesc)
&& (attr_arch == TAG_CPU_ARCH_V6_M
|| attr_arch == TAG_CPU_ARCH_V6S_M
|| attr_profile == 'M'))
is_m = true;
#endif
}
if (fp_model == ARM_FLOAT_AUTO)
{
switch (e_flags & (EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT))
{
case 0:
/* Leave it as "auto". Strictly speaking this case
means FPA, but almost nobody uses that now, and
many toolchains fail to set the appropriate bits
for the floating-point model they use. */
break;
case EF_ARM_SOFT_FLOAT:
fp_model = ARM_FLOAT_SOFT_FPA;
break;
case EF_ARM_VFP_FLOAT:
fp_model = ARM_FLOAT_VFP;
break;
case EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT:
fp_model = ARM_FLOAT_SOFT_VFP;
break;
}
}
if (e_flags & EF_ARM_BE8)
info.byte_order_for_code = BFD_ENDIAN_LITTLE;
break;
default:
/* Leave it as "auto". */
break;
}
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
/* Check any target description for validity. */
if (tdesc_has_registers (tdesc))
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
{
/* For most registers we require GDB's default names; but also allow
the numeric names for sp / lr / pc, as a convenience. */
static const char *const arm_sp_names[] = { "r13", "sp", NULL };
static const char *const arm_lr_names[] = { "r14", "lr", NULL };
static const char *const arm_pc_names[] = { "r15", "pc", NULL };
const struct tdesc_feature *feature;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
int valid_p;
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
feature = tdesc_find_feature (tdesc,
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
"org.gnu.gdb.arm.core");
if (feature == NULL)
{
feature = tdesc_find_feature (tdesc,
"org.gnu.gdb.arm.m-profile");
if (feature == NULL)
return NULL;
else
is_m = true;
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
tdesc_data = tdesc_data_alloc ();
valid_p = 1;
for (i = 0; i < ARM_SP_REGNUM; i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
arm_register_names[i]);
valid_p &= tdesc_numbered_register_choices (feature, tdesc_data,
ARM_SP_REGNUM,
arm_sp_names);
valid_p &= tdesc_numbered_register_choices (feature, tdesc_data,
ARM_LR_REGNUM,
arm_lr_names);
valid_p &= tdesc_numbered_register_choices (feature, tdesc_data,
ARM_PC_REGNUM,
arm_pc_names);
if (is_m)
valid_p &= tdesc_numbered_register (feature, tdesc_data,
ARM_PS_REGNUM, "xpsr");
else
valid_p &= tdesc_numbered_register (feature, tdesc_data,
ARM_PS_REGNUM, "cpsr");
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
if (!valid_p)
{
tdesc_data_cleanup (tdesc_data);
return NULL;
}
feature = tdesc_find_feature (tdesc,
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
"org.gnu.gdb.arm.fpa");
if (feature != NULL)
{
valid_p = 1;
for (i = ARM_F0_REGNUM; i <= ARM_FPS_REGNUM; i++)
valid_p &= tdesc_numbered_register (feature, tdesc_data, i,
arm_register_names[i]);
if (!valid_p)
{
tdesc_data_cleanup (tdesc_data);
return NULL;
}
}
else
have_fpa_registers = false;
feature = tdesc_find_feature (tdesc,
"org.gnu.gdb.xscale.iwmmxt");
if (feature != NULL)
{
static const char *const iwmmxt_names[] = {
"wR0", "wR1", "wR2", "wR3", "wR4", "wR5", "wR6", "wR7",
"wR8", "wR9", "wR10", "wR11", "wR12", "wR13", "wR14", "wR15",
"wCID", "wCon", "wCSSF", "wCASF", "", "", "", "",
"wCGR0", "wCGR1", "wCGR2", "wCGR3", "", "", "", "",
};
valid_p = 1;
for (i = ARM_WR0_REGNUM; i <= ARM_WR15_REGNUM; i++)
valid_p
&= tdesc_numbered_register (feature, tdesc_data, i,
iwmmxt_names[i - ARM_WR0_REGNUM]);
/* Check for the control registers, but do not fail if they
are missing. */
for (i = ARM_WC0_REGNUM; i <= ARM_WCASF_REGNUM; i++)
tdesc_numbered_register (feature, tdesc_data, i,
iwmmxt_names[i - ARM_WR0_REGNUM]);
for (i = ARM_WCGR0_REGNUM; i <= ARM_WCGR3_REGNUM; i++)
valid_p
&= tdesc_numbered_register (feature, tdesc_data, i,
iwmmxt_names[i - ARM_WR0_REGNUM]);
if (!valid_p)
{
tdesc_data_cleanup (tdesc_data);
return NULL;
}
have_wmmx_registers = true;
}
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* If we have a VFP unit, check whether the single precision registers
are present. If not, then we will synthesize them as pseudo
registers. */
feature = tdesc_find_feature (tdesc,
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
"org.gnu.gdb.arm.vfp");
if (feature != NULL)
{
static const char *const vfp_double_names[] = {
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
"d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
"d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
"d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
};
/* Require the double precision registers. There must be either
16 or 32. */
valid_p = 1;
for (i = 0; i < 32; i++)
{
valid_p &= tdesc_numbered_register (feature, tdesc_data,
ARM_D0_REGNUM + i,
vfp_double_names[i]);
if (!valid_p)
break;
}
if (!valid_p && i == 16)
valid_p = 1;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* Also require FPSCR. */
valid_p &= tdesc_numbered_register (feature, tdesc_data,
ARM_FPSCR_REGNUM, "fpscr");
if (!valid_p)
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
{
tdesc_data_cleanup (tdesc_data);
return NULL;
}
if (tdesc_unnumbered_register (feature, "s0") == 0)
have_vfp_pseudos = true;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
vfp_register_count = i;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* If we have VFP, also check for NEON. The architecture allows
NEON without VFP (integer vector operations only), but GDB
does not support that. */
feature = tdesc_find_feature (tdesc,
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
"org.gnu.gdb.arm.neon");
if (feature != NULL)
{
/* NEON requires 32 double-precision registers. */
if (i != 32)
{
tdesc_data_cleanup (tdesc_data);
return NULL;
}
/* If there are quad registers defined by the stub, use
their type; otherwise (normally) provide them with
the default type. */
if (tdesc_unnumbered_register (feature, "q0") == 0)
have_neon_pseudos = true;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
have_neon = true;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
}
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
}
/* If there is already a candidate, use it. */
for (best_arch = gdbarch_list_lookup_by_info (arches, &info);
best_arch != NULL;
best_arch = gdbarch_list_lookup_by_info (best_arch->next, &info))
{
if (arm_abi != ARM_ABI_AUTO
&& arm_abi != gdbarch_tdep (best_arch->gdbarch)->arm_abi)
continue;
if (fp_model != ARM_FLOAT_AUTO
&& fp_model != gdbarch_tdep (best_arch->gdbarch)->fp_model)
continue;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* There are various other properties in tdep that we do not
need to check here: those derived from a target description,
since gdbarches with a different target description are
automatically disqualified. */
/* Do check is_m, though, since it might come from the binary. */
if (is_m != gdbarch_tdep (best_arch->gdbarch)->is_m)
continue;
/* Found a match. */
break;
}
if (best_arch != NULL)
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
{
if (tdesc_data != NULL)
tdesc_data_cleanup (tdesc_data);
return best_arch->gdbarch;
}
Replace some xmalloc-family functions with XNEW-family ones This patch is part of the make-gdb-buildable-in-C++ effort. The idea is to change some calls to the xmalloc family of functions to calls to the equivalents in the XNEW family. This avoids adding an explicit cast, so it keeps the code a bit more readable. Some of them also map relatively well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be possible to do scripted replacements if needed. I only changed calls that were obviously allocating memory for one or multiple "objects". Allocation of variable sizes (such as strings or buffer handling) will be for later (and won't use XNEW). - xmalloc (sizeof (struct foo)) -> XNEW (struct foo) - xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num) - xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo) - xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num) - xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num) - obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo) - obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num) - alloca (sizeof (struct foo)) -> XALLOCA (struct foo) - alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num) Some instances of xmalloc followed by memset to zero the buffer were replaced by XCNEW or XCNEWVEC. I regtested on x86-64, Ubuntu 14.04, but the patch touches many architecture-specific files. For those I'll have to rely on the buildbot or people complaining that I broke their gdb. gdb/ChangeLog: * aarch64-linux-nat.c (aarch64_add_process): Likewise. * aarch64-tdep.c (aarch64_gdbarch_init): Likewise. * ada-exp.y (write_ambiguous_var): Likewise. * ada-lang.c (resolve_subexp): Likewise. (user_select_syms): Likewise. (assign_aggregate): Likewise. (ada_evaluate_subexp): Likewise. (cache_symbol): Likewise. * addrmap.c (allocate_key): Likewise. (addrmap_create_mutable): Likewise. * aix-thread.c (sync_threadlists): Likewise. * alpha-tdep.c (alpha_push_dummy_call): Likewise. (alpha_gdbarch_init): Likewise. * amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise. * arm-linux-nat.c (arm_linux_add_process): Likewise. * arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise. * arm-tdep.c (push_stack_item): Likewise. (arm_displaced_step_copy_insn): Likewise. (arm_gdbarch_init): Likewise. (_initialize_arm_tdep): Likewise. * avr-tdep.c (push_stack_item): Likewise. * ax-general.c (new_agent_expr): Likewise. * block.c (block_initialize_namespace): Likewise. * breakpoint.c (alloc_counted_command_line): Likewise. (update_dprintf_command_list): Likewise. (parse_breakpoint_sals): Likewise. (decode_static_tracepoint_spec): Likewise. (until_break_command): Likewise. (clear_command): Likewise. (update_global_location_list): Likewise. (get_breakpoint_objfile_data) Likewise. * btrace.c (ftrace_new_function): Likewise. (btrace_set_insn_history): Likewise. (btrace_set_call_history): Likewise. * buildsym.c (add_symbol_to_list): Likewise. (record_pending_block): Likewise. (start_subfile): Likewise. (start_buildsym_compunit): Likewise. (push_subfile): Likewise. (end_symtab_get_static_block): Likewise. (buildsym_init): Likewise. * cli/cli-cmds.c (source_command): Likewise. * cli/cli-decode.c (add_cmd): Likewise. * cli/cli-script.c (build_command_line): Likewise. (setup_user_args): Likewise. (realloc_body_list): Likewise. (process_next_line): Likewise. (copy_command_lines): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (read_pe_exported_syms): Likewise. * coffread.c (coff_locate_sections): Likewise. (coff_symtab_read): Likewise. (coff_read_struct_type): Likewise. * common/cleanups.c (make_my_cleanup2): Likewise. * common/common-exceptions.c (throw_it): Likewise. * common/filestuff.c (make_cleanup_close): Likewise. * common/format.c (parse_format_string): Likewise. * common/queue.h (DEFINE_QUEUE_P): Likewise. * compile/compile-object-load.c (munmap_list_add): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * compile/compile.c (append_args): Likewise. * corefile.c (specify_exec_file_hook): Likewise. * cp-support.c (make_symbol_overload_list): Likewise. * cris-tdep.c (push_stack_item): Likewise. (cris_gdbarch_init): Likewise. * ctf.c (ctf_trace_file_writer_new): Likewise. * dbxread.c (init_header_files): Likewise. (add_new_header_file): Likewise. (init_bincl_list): Likewise. (dbx_end_psymtab): Likewise. (start_psymtab): Likewise. (dbx_end_psymtab): Likewise. * dcache.c (dcache_init): Likewise. * dictionary.c (dict_create_hashed): Likewise. (dict_create_hashed_expandable): Likewise. (dict_create_linear): Likewise. (dict_create_linear_expandable): Likewise. * dtrace-probe.c (dtrace_process_dof_probe): Likewise. * dummy-frame.c (register_dummy_frame_dtor): Likewise. * dwarf2-frame-tailcall.c (cache_new_ref1): Likewise. * dwarf2-frame.c (dwarf2_build_frame_info): Likewise. (decode_frame_entry_1): Likewise. * dwarf2expr.c (new_dwarf_expr_context): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. * dwarf2read.c (dwarf2_has_info): Likewise. (create_signatured_type_table_from_index): Likewise. (dwarf2_read_index): Likewise. (dw2_get_file_names_reader): Likewise. (create_all_type_units): Likewise. (read_cutu_die_from_dwo): Likewise. (init_tu_and_read_dwo_dies): Likewise. (init_cutu_and_read_dies): Likewise. (create_all_comp_units): Likewise. (queue_comp_unit): Likewise. (inherit_abstract_dies): Likewise. (read_call_site_scope): Likewise. (dwarf2_add_field): Likewise. (dwarf2_add_typedef): Likewise. (dwarf2_add_member_fn): Likewise. (attr_to_dynamic_prop): Likewise. (abbrev_table_alloc_abbrev): Likewise. (abbrev_table_read_table): Likewise. (add_include_dir): Likewise. (add_file_name): Likewise. (dwarf_decode_line_header): Likewise. (dwarf2_const_value_attr): Likewise. (dwarf_alloc_block): Likewise. (parse_macro_definition): Likewise. (set_die_type): Likewise. (write_psymtabs_to_index): Likewise. (create_cus_from_index): Likewise. (dwarf2_create_include_psymtab): Likewise. (process_psymtab_comp_unit_reader): Likewise. (build_type_psymtab_dependencies): Likewise. (read_comp_units_from_section): Likewise. (compute_compunit_symtab_includes): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (load_partial_dies): Likewise. (dwarf2_symbol_mark_computed): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_read_minimal_symbols): Likewise. * environ.c (make_environ): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * event-loop.c (create_file_handler): Likewise. (create_async_signal_handler): Likewise. (create_async_event_handler): Likewise. (create_timer): Likewise. * exec.c (build_section_table): Likewise. * fbsd-nat.c (fbsd_remember_child): Likewise. * fork-child.c (fork_inferior): Likewise. * frv-tdep.c (new_variant): Likewise. * gdbarch.sh (gdbarch_alloc): Likewise. (append_name): Likewise. * gdbtypes.c (rank_function): Likewise. (copy_type_recursive): Likewise. (add_dyn_prop): Likewise. * gnu-nat.c (make_proc): Likewise. (make_inf): Likewise. (gnu_write_inferior): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise. (build_std_type_info_type): Likewise. * guile/scm-param.c (compute_enum_list): Likewise. * guile/scm-utils.c (gdbscm_parse_function_args): Likewise. * guile/scm-value.c (gdbscm_value_call): Likewise. * h8300-tdep.c (h8300_gdbarch_init): Likewise. * hppa-tdep.c (hppa_init_objfile_priv_data): Likewise. (read_unwind_info): Likewise. * ia64-tdep.c (ia64_gdbarch_init): Likewise. * infcall.c (dummy_frame_context_saver_setup): Likewise. (call_function_by_hand_dummy): Likewise. * infcmd.c (step_once): Likewise. (finish_forward): Likewise. (attach_command): Likewise. (notice_new_inferior): Likewise. * inferior.c (add_inferior_silent): Likewise. * infrun.c (add_displaced_stepping_state): Likewise. (save_infcall_control_state): Likewise. (save_inferior_ptid): Likewise. (_initialize_infrun): Likewise. * jit.c (bfd_open_from_target_memory): Likewise. (jit_gdbarch_data_init): Likewise. * language.c (add_language): Likewise. * linespec.c (decode_line_2): Likewise. * linux-nat.c (add_to_pid_list): Likewise. (add_initial_lwp): Likewise. * linux-thread-db.c (add_thread_db_info): Likewise. (record_thread): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_gdbarch_init): Likewise. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * m68k-tdep.c (m68k_gdbarch_init): Likewise. * m88k-tdep.c (m88k_analyze_prologue): Likewise. * macrocmd.c (macro_define_command): Likewise. * macroexp.c (gather_arguments): Likewise. * macroscope.c (sal_macro_scope): Likewise. * macrotab.c (new_macro_table): Likewise. * mdebugread.c (push_parse_stack): Likewise. (parse_partial_symbols): Likewise. (parse_symbol): Likewise. (psymtab_to_symtab_1): Likewise. (new_block): Likewise. (new_psymtab): Likewise. (mdebug_build_psymtabs): Likewise. (add_pending): Likewise. (elfmdebug_build_psymtabs): Likewise. * mep-tdep.c (mep_gdbarch_init): Likewise. * mi/mi-main.c (mi_execute_command): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. * minidebug.c (lzma_open): Likewise. * minsyms.c (terminate_minimal_symbol_table): Likewise. * mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * mt-tdep.c (mt_registers_info): Likewise. * nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise. * nat/linux-btrace.c (linux_enable_bts): Likewise. (linux_enable_pt): Likewise. * nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise. (linux_xfer_osdata_processgroups): Likewise. * nios2-tdep.c (nios2_gdbarch_init): Likewise. * nto-procfs.c (procfs_meminfo): Likewise. * objc-lang.c (start_msglist): Likewise. (selectors_info): Likewise. (classes_info): Likewise. (find_methods): Likewise. * objfiles.c (allocate_objfile): Likewise. (update_section_map): Likewise. * osabi.c (gdbarch_register_osabi): Likewise. (gdbarch_register_osabi_sniffer): Likewise. * parse.c (start_arglist): Likewise. * ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise. (hwdebug_insert_point): Likewise. * printcmd.c (display_command): Likewise. (ui_printf): Likewise. * procfs.c (create_procinfo): Likewise. (load_syscalls): Likewise. (proc_get_LDT_entry): Likewise. (proc_update_threads): Likewise. * prologue-value.c (make_pv_area): Likewise. (pv_area_store): Likewise. * psymtab.c (extend_psymbol_list): Likewise. (init_psymbol_list): Likewise. (allocate_psymtab): Likewise. * python/py-inferior.c (add_thread_object): Likewise. * python/py-param.c (compute_enum_values): Likewise. * python/py-value.c (valpy_call): Likewise. * python/py-varobj.c (py_varobj_iter_next): Likewise. * python/python.c (ensure_python_env): Likewise. * record-btrace.c (record_btrace_start_replaying): Likewise. * record-full.c (record_full_reg_alloc): Likewise. (record_full_mem_alloc): Likewise. (record_full_end_alloc): Likewise. (record_full_core_xfer_partial): Likewise. * regcache.c (get_thread_arch_aspace_regcache): Likewise. * remote-fileio.c (remote_fileio_init_fd_map): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (demand_private_info): Likewise. (remote_notif_stop_alloc_reply): Likewise. (remote_enable_btrace): Likewise. * reverse.c (save_bookmark_command): Likewise. * rl78-tdep.c (rl78_gdbarch_init): Likewise. * rx-tdep.c (rx_gdbarch_init): Likewise. * s390-linux-nat.c (s390_insert_watchpoint): Likewise. * ser-go32.c (dos_get_tty_state): Likewise. (dos_copy_tty_state): Likewise. * ser-mingw.c (ser_windows_open): Likewise. (ser_console_wait_handle): Likewise. (ser_console_get_tty_state): Likewise. (make_pipe_state): Likewise. (net_windows_open): Likewise. * ser-unix.c (hardwire_get_tty_state): Likewise. (hardwire_copy_tty_state): Likewise. * solib-aix.c (solib_aix_new_lm_info): Likewise. * solib-dsbt.c (dsbt_current_sos): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (frv_current_sos): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_bfd_fopen): Likewise. * solib-svr4.c (lm_info_read): Likewise. (svr4_copy_library_list): Likewise. (svr4_default_sos): Likewise. * source.c (find_source_lines): Likewise. (line_info): Likewise. (add_substitute_path_rule): Likewise. * spu-linux-nat.c (spu_bfd_open): Likewise. * spu-tdep.c (info_spu_dma_cmdlist): Likewise. * stabsread.c (dbx_lookup_type): Likewise. (read_type): Likewise. (read_member_functions): Likewise. (read_struct_fields): Likewise. (read_baseclasses): Likewise. (read_args): Likewise. (_initialize_stabsread): Likewise. * stack.c (func_command): Likewise. * stap-probe.c (handle_stap_probe): Likewise. * symfile.c (addrs_section_sort): Likewise. (addr_info_make_relative): Likewise. (load_section_callback): Likewise. (add_symbol_file_command): Likewise. (init_filename_language_table): Likewise. * symtab.c (create_filename_seen_cache): Likewise. (sort_search_symbols_remove_dups): Likewise. (search_symbols): Likewise. * target.c (make_cleanup_restore_target_terminal): Likewise. * thread.c (new_thread): Likewise. (enable_thread_stack_temporaries): Likewise. (make_cleanup_restore_current_thread): Likewise. (thread_apply_all_command): Likewise. * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. * top.c (gdb_readline_wrapper): Likewise. * tracefile-tfile.c (tfile_trace_file_writer_new): Likewise. * tracepoint.c (trace_find_line_command): Likewise. (all_tracepoint_actions_and_cleanup): Likewise. (make_cleanup_restore_current_traceframe): Likewise. (get_uploaded_tp): Likewise. (get_uploaded_tsv): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_alloc_content): Likewise. (tui_add_content_elements): Likewise. * tui/tui-disasm.c (tui_find_disassembly_address): Likewise. (tui_set_disassem_content): Likewise. * ui-file.c (ui_file_new): Likewise. (stdio_file_new): Likewise. (tee_file_new): Likewise. * utils.c (make_cleanup_restore_integer): Likewise. (add_internal_problem_command): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise. * valops.c (find_oload_champ): Likewise. * value.c (allocate_value_lazy): Likewise. (record_latest_value): Likewise. (create_internalvar): Likewise. * varobj.c (install_variable): Likewise. (new_variable): Likewise. (new_root_variable): Likewise. (cppush): Likewise. (_initialize_varobj): Likewise. * windows-nat.c (windows_make_so): Likewise. * x86-nat.c (x86_add_process): Likewise. * xcoffread.c (arrange_linetable): Likewise. (allocate_include_entry): Likewise. (process_linenos): Likewise. (SYMBOL_DUP): Likewise. (xcoff_start_psymtab): Likewise. (xcoff_end_psymtab): Likewise. * xml-support.c (gdb_xml_parse_attr_ulongest): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Likewise. (compile_bytecodes): Likewise. * dll.c (loaded_dll): Likewise. * event-loop.c (append_callback_event): Likewise. (create_file_handler): Likewise. (create_file_event): Likewise. * hostio.c (handle_open): Likewise. * inferiors.c (add_thread): Likewise. (add_process): Likewise. * linux-aarch64-low.c (aarch64_linux_new_process): Likewise. * linux-arm-low.c (arm_new_process): Likewise. (arm_new_thread): Likewise. * linux-low.c (add_to_pid_list): Likewise. (linux_add_process): Likewise. (handle_extended_wait): Likewise. (add_lwp): Likewise. (enqueue_one_deferred_signal): Likewise. (enqueue_pending_signal): Likewise. (linux_resume_one_lwp_throw): Likewise. (linux_resume_one_thread): Likewise. (linux_read_memory): Likewise. (linux_write_memory): Likewise. * linux-mips-low.c (mips_linux_new_process): Likewise. (mips_linux_new_thread): Likewise. (mips_add_watchpoint): Likewise. * linux-x86-low.c (initialize_low_arch): Likewise. * lynx-low.c (lynx_add_process): Likewise. * mem-break.c (set_raw_breakpoint_at): Likewise. (set_breakpoint): Likewise. (add_condition_to_breakpoint): Likewise. (add_commands_to_breakpoint): Likewise. (clone_agent_expr): Likewise. (clone_one_breakpoint): Likewise. * regcache.c (new_register_cache): Likewise. * remote-utils.c (look_up_one_symbol): Likewise. * server.c (queue_stop_reply): Likewise. (start_inferior): Likewise. (queue_stop_reply_callback): Likewise. (handle_target_event): Likewise. * spu-low.c (fetch_ppc_memory): Likewise. (store_ppc_memory): Likewise. * target.c (set_target_ops): Likewise. * thread-db.c (thread_db_load_search): Likewise. (try_thread_db_load_1): Likewise. * tracepoint.c (add_tracepoint): Likewise. (add_tracepoint_action): Likewise. (create_trace_state_variable): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtro): Likewise. (add_while_stepping_state): Likewise. * win32-low.c (child_add_thread): Likewise. (get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
/* Record additional information about the architecture we are defining.
These are gdbarch discriminators, like the OSABI. */
tdep->arm_abi = arm_abi;
tdep->fp_model = fp_model;
tdep->is_m = is_m;
tdep->have_fpa_registers = have_fpa_registers;
tdep->have_wmmx_registers = have_wmmx_registers;
gdb_assert (vfp_register_count == 0
|| vfp_register_count == 16
|| vfp_register_count == 32);
tdep->vfp_register_count = vfp_register_count;
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
tdep->have_vfp_pseudos = have_vfp_pseudos;
tdep->have_neon_pseudos = have_neon_pseudos;
tdep->have_neon = have_neon;
arm_register_g_packet_guesses (gdbarch);
/* Breakpoints. */
switch (info.byte_order_for_code)
{
case BFD_ENDIAN_BIG:
tdep->arm_breakpoint = arm_default_arm_be_breakpoint;
tdep->arm_breakpoint_size = sizeof (arm_default_arm_be_breakpoint);
tdep->thumb_breakpoint = arm_default_thumb_be_breakpoint;
tdep->thumb_breakpoint_size = sizeof (arm_default_thumb_be_breakpoint);
break;
case BFD_ENDIAN_LITTLE:
tdep->arm_breakpoint = arm_default_arm_le_breakpoint;
tdep->arm_breakpoint_size = sizeof (arm_default_arm_le_breakpoint);
tdep->thumb_breakpoint = arm_default_thumb_le_breakpoint;
tdep->thumb_breakpoint_size = sizeof (arm_default_thumb_le_breakpoint);
break;
default:
internal_error (__FILE__, __LINE__,
_("arm_gdbarch_init: bad byte order for float format"));
}
/* On ARM targets char defaults to unsigned. */
set_gdbarch_char_signed (gdbarch, 0);
Teach GDB that wchar_t is a built-in type in C++ mode GDB is currently not aware that wchar_t is a built-in type in C++ mode. This is usually not a problem because the debug info describes the type, so when you have a program loaded, you don't notice this. However, if you try expressions involving wchar_t before a program is loaded, gdb errors out: (gdb) p (wchar_t)-1 No symbol table is loaded. Use the "file" command. (gdb) p L"hello" No type named wchar_t. (gdb) ptype L"hello" No type named wchar_t. This commit teaches gdb about the type. After: (gdb) p (wchar_t)-1 $1 = -1 L'\xffffffff' (gdb) p L"hello" $2 = L"hello" (gdb) ptype L"hello" type = wchar_t [6] Unlike char16_t/char32_t, unfortunately, the underlying type of wchar_t is implementation dependent, both size and signness. So this requires adding a couple new gdbarch hooks. I grepped the GCC code base for WCHAR_TYPE and WCHAR_TYPE_SIZE, and it seems to me that the majority of the ABIs have a 4-byte signed wchar_t, so that's what I made the default for GDB too. And then I looked for which ports have a 16-bit and/or unsigned wchar_t, and made GDB follow suit. gdb/ChangeLog: 2017-04-12 Pedro Alves <palves@redhat.com> PR gdb/21323 * c-lang.c (cplus_primitive_types) <cplus_primitive_type_wchar_t>: New enum value. (cplus_language_arch_info): Register cplus_primitive_type_wchar_t. * gdbtypes.h (struct builtin_type) <builtin_wchar>: New field. * gdbtypes.c (gdbtypes_post_init): Create the "wchar_t" type. * gdbarch.sh (wchar_bit, wchar_signed): New per-arch values. * gdbarch.h, gdbarch.c: Regenerate. * aarch64-tdep.c (aarch64_gdbarch_init): Override gdbarch_wchar_bit and gdbarch_wchar_signed. * alpha-tdep.c (alpha_gdbarch_init): Likewise. * arm-tdep.c (arm_gdbarch_init): Likewise. * avr-tdep.c (avr_gdbarch_init): Likewise. * h8300-tdep.c (h8300_gdbarch_init): Likewise. * i386-nto-tdep.c (i386nto_init_abi): Likewise. * i386-tdep.c (i386_go32_init_abi): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * nds32-tdep.c (nds32_gdbarch_init): Likewise. * rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * sparc-tdep.c (sparc32_gdbarch_init): Likewise. * sparc64-tdep.c (sparc64_init_abi): Likewise. * windows-tdep.c (windows_init_abi): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. gdb/testsuite/ChangeLog: 2017-04-12 Pedro Alves <palves@redhat.com> PR gdb/21323 * gdb.cp/wide_char_types.c: Include <wchar.h>. (wchar): New global. * gdb.cp/wide_char_types.exp (wide_char_types_program) (do_test_wide_char, wide_char_types_no_program, top level): Add wchar_t testing.
2017-04-12 15:00:49 +02:00
/* wchar_t is unsigned under the AAPCS. */
if (tdep->arm_abi == ARM_ABI_AAPCS)
set_gdbarch_wchar_signed (gdbarch, 0);
else
set_gdbarch_wchar_signed (gdbarch, 1);
/* Compute type alignment. */
set_gdbarch_type_align (gdbarch, arm_type_align);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* Note: for displaced stepping, this includes the breakpoint, and one word
of additional scratch space. This setting isn't used for anything beside
displaced stepping at present. */
set_gdbarch_max_insn_length (gdbarch, 4 * ARM_DISPLACED_MODIFIED_INSNS);
* arm-linux-tdep.c (arch-utils.h, inferior.h, gdbthread.h, symfile.h): Include files. (arm_linux_cleanup_svc, arm_linux_copy_svc): New. (cleanup_kernel_helper_return, arm_catch_kernel_helper_return): New. (arm_linux_displaced_step_copy_insn): New. (arm_linux_init_abi): Initialise displaced stepping callbacks. * arm-tdep.c (DISPLACED_STEPPING_ARCH_VERSION): New macro. (ARM_NOP): New. (displaced_read_reg, displaced_in_arm_mode, branch_write_pc) (bx_write_pc, load_write_pc, alu_write_pc, displaced_write_reg) (insn_references_pc, copy_unmodified, cleanup_preload, copy_preload) (copy_preload_reg, cleanup_copro_load_store, copy_copro_load_store) (cleanup_branch, copy_b_bl_blx, copy_bx_blx_reg, cleanup_alu_imm) (copy_alu_imm, cleanup_alu_reg, copy_alu_reg) (cleanup_alu_shifted_reg, copy_alu_shifted_reg, cleanup_load) (cleanup_store, copy_extra_ld_st, copy_ldr_str_ldrb_strb) (cleanup_block_load_all, cleanup_block_store_pc) (cleanup_block_load_pc, copy_block_xfer, cleanup_svc, copy_svc) (copy_undef, copy_unpred): New. (decode_misc_memhint_neon, decode_unconditional) (decode_miscellaneous, decode_dp_misc, decode_ld_st_word_ubyte) (decode_media, decode_b_bl_ldmstm, decode_ext_reg_ld_st) (decode_svc_copro, arm_process_displaced_insn) (arm_displaced_init_closure, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): New. (arm_gdbarch_init): Initialise max insn length field. * arm-tdep.h (DISPLACED_TEMPS, DISPLACED_MODIFIED_INSNS): New macros. (displaced_step_closure, pc_write_style): New. (arm_displaced_init_closure, displaced_read_reg) (arm_process_displaced_insn, arm_displaced_init_closure) (displaced_read_reg, displaced_write_reg, arm_displaced_step_copy_insn) (arm_displaced_step_fixup): Add prototypes.
2009-07-31 01:05:05 +02:00
/* This should be low enough for everything. */
tdep->lowest_pc = 0x20;
tdep->jb_pc = -1; /* Longjump support not enabled by default. */
/* The default, for both APCS and AAPCS, is to return small
structures in registers. */
tdep->struct_return = reg_struct_return;
set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call);
set_gdbarch_frame_align (gdbarch, arm_frame_align);
Skip unwritable frames in command "finish" Nowadays, GDB can't insert breakpoint on the return address of the exception handler on ARM M-profile, because the address is a magic one 0xfffffff9, (gdb) bt #0 CT32B1_IRQHandler () at ../src/timer.c:67 #1 <signal handler called> #2 main () at ../src/timer.c:127 (gdb) info frame Stack level 0, frame at 0x200ffa8: pc = 0x4ec in CT32B1_IRQHandler (../src/timer.c:67); saved pc = 0xfffffff9 called by frame at 0x200ffc8 source language c. Arglist at 0x200ffa0, args: Locals at 0x200ffa0, Previous frame's sp is 0x200ffa8 Saved registers: r7 at 0x200ffa0, lr at 0x200ffa4 (gdb) x/x 0xfffffff9 0xfffffff9: Cannot access memory at address 0xfffffff9 (gdb) finish Run till exit from #0 CT32B1_IRQHandler () at ../src/timer.c:67 Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?) Warning: Cannot insert hardware breakpoint 0. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. Command aborted. even some debug probe can't set hardware breakpoint on the magic address too, (gdb) hbreak *0xfffffff9 Hardware assisted breakpoint 2 at 0xfffffff9 (gdb) c Continuing. Ed:15: Target error from Set break/watch: Et:96: Pseudo-address (0xFFFFFFxx) for EXC_RETURN is invalid (GDB error?) Warning: Cannot insert hardware breakpoint 2. Could not insert hardware breakpoints: You may have requested too many hardware breakpoints/watchpoints. Command aborted. The problem described above is quite similar to PR 8841, in which GDB can't set breakpoint on signal trampoline, which is mapped to a read-only page by kernel. The rationale of this patch is to skip "unwritable" frames when looking for caller frames in command "finish", and a new gdbarch method code_of_frame_writable is added. This patch fixes the problem on ARM cortex-m target, but it can be used to fix PR 8841 too. gdb: 2016-05-10 Yao Qi <yao.qi@arm.com> * arch-utils.c (default_code_of_frame_writable): New function. * arch-utils.h (default_code_of_frame_writable): Declare. * arm-tdep.c (arm_code_of_frame_writable): New function. (arm_gdbarch_init): Install gdbarch method code_of_frame_writable if the target is M-profile. * frame.c (skip_unwritable_frames): New function. * frame.h (skip_unwritable_frames): Declare. * gdbarch.sh (code_of_frame_writable): New. * gdbarch.c, gdbarch.h: Re-generated. * infcmd.c (finish_command): Call skip_unwritable_frames.
2016-05-23 18:32:56 +02:00
if (is_m)
set_gdbarch_code_of_frame_writable (gdbarch, arm_code_of_frame_writable);
set_gdbarch_write_pc (gdbarch, arm_write_pc);
frame_base_set_default (gdbarch, &arm_normal_base);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* Address manipulation. */
set_gdbarch_addr_bits_remove (gdbarch, arm_addr_bits_remove);
/* Advance PC across function entry code. */
set_gdbarch_skip_prologue (gdbarch, arm_skip_prologue);
/* Detect whether PC is at a point where the stack has been destroyed. */
set_gdbarch_stack_frame_destroyed_p (gdbarch, arm_stack_frame_destroyed_p);
/* Skip trampolines. */
set_gdbarch_skip_trampoline_code (gdbarch, arm_skip_stub);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* The stack grows downward. */
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
/* Breakpoint manipulation. */
Remove GDBARCH_BREAKPOINT_MANIPULATION and SET_GDBARCH_BREAKPOINT_MANIPULATION Both of them are used in conversion. We can remove them since the conversion is done. There are many architectures only have one breakpoint instruction, so their gdbarch methods breakpoint_kind_from_pc and sw_breakpoint_from_kind look very similar. Instead of macro, we use template "template <size_t, const gdb_byte *> struct bp_manipulation" for these architectures. In order to use template, I also change breakpoint instruction of type "static const gdb_byte[]" to "constexpr gdb_byte[]", and rename them to ARCH_break_insn. gdb: 2016-11-03 Yao Qi <yao.qi@linaro.org> Pedro Alves <palves@redhat.com> * aarch64-tdep.c (aarch64_default_breakpoint): Change it to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (aarch64_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * alpha-tdep.c (break_insn): Rename to alpha_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (alpha_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * arc-tdep.c (arc_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * arch-utils.h (GDBARCH_BREAKPOINT_MANIPULATION): Remove. (struct bp_manipulation): New. (SET_GDBARCH_BREAKPOINT_MANIPULATION): Remove. (struct bp_manipulation_endian): New. (BP_MANIPULATION): New. (BP_MANIPULATION_ENDIAN): New. * arm-tdep.c (arm_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * avr-tdep.c (avr_break_insn): Change it constexpr. (avr_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cris-tdep.c (cris_gdbarch_init): Likewise. * frv-tdep.c (breakpoint): Rename it to frv_break_insn, and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (frv_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * ft32-tdep.c (breakpoint): Rename it to ft32_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (ft32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * h8300-tdep.c (breakpoint): Rename it to h8300_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (h8300_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * hppa-tdep.c (breakpoint): Rename it to h8300_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (hppa_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * i386-tdep.c (break_insn): Rename it to i386_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (i386_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * iq2000-tdep.c (iq2000_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * lm32-tdep.c (breakpoint): Rename it to lm32_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (lm32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m32c-tdep.c (break_insn): Rename it to m32c_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m32c_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * m68hc11-tdep.c (breakpoint): Rename it to m68hc11_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m68hc11_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m68k-tdep.c (break_insn): Rename it to m68k_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m68k_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * m88k-tdep.c (break_insn): Rename it to m88k_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (m88k_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * mep-tdep.c (breakpoint): Rename it to mep_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (mep_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * microblaze-tdep.c (break_insn): Rename it to microblaze_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (microblaze_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (breakpoint): Rename it to mn10300_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (mn10300_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * moxie-tdep.c (breakpoint): Rename it to moxie_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (moxie_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * msp430-tdep.c (breakpoint): Rename it to msp430_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (msp430_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * mt-tdep.c (mt_gdbarch_init): Likewise. * nds32-tdep.c (break_insn): Rename it to nds32_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (nds32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * nios2-tdep.c (nios2_gdbarch_init): Likewise. * rl78-tdep.c (breakpoint): Rename it to rl78_break_ins and change its type to rl78_break_insn. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (rl78_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * rs6000-tdep.c (big_breakpoint): Change its type to constexpr. (little_breakpoint): Likewise. Don't use GDBARCH_BREAKPOINT_MANIPULATION_ENDIAN. (rs6000_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * rx-tdep.c (breakpoint): Rename it to rx_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (rx_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * s390-linux-tdep.c (breakpoint): Rename it to s390_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION (s390_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * score-tdep.c (score_gdbarch_init): Likewise. * sh-tdep.c (sh_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sparc-tdep.c (break_insn): Rename it to sparc_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (sparc32_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * spu-tdep.c (breakpoint): Rename it to spu_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (spu_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. * tilegx-tdep.c (breakpoint): Rename it to tilegx_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (tilegx_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * v850-tdep.c (v850_gdbarch_init): Likewise. * vax-tdep.c (break_insn): Rename it to vax_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (vax_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * xstormy16-tdep.c (breakpoint): Rename it to xstormy16_break_insn and change its type to constexpr. Don't use GDBARCH_BREAKPOINT_MANIPULATION. (xstormy16_gdbarch_init): Don't use SET_GDBARCH_BREAKPOINT_MANIPULATION. * xtensa-tdep.c (xtensa_gdbarch_init): Likewise.
2016-11-03 15:35:14 +01:00
set_gdbarch_breakpoint_kind_from_pc (gdbarch, arm_breakpoint_kind_from_pc);
set_gdbarch_sw_breakpoint_from_kind (gdbarch, arm_sw_breakpoint_from_kind);
set_gdbarch_breakpoint_kind_from_current_state (gdbarch,
arm_breakpoint_kind_from_current_state);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* Information about registers, etc. */
set_gdbarch_sp_regnum (gdbarch, ARM_SP_REGNUM);
set_gdbarch_pc_regnum (gdbarch, ARM_PC_REGNUM);
set_gdbarch_num_regs (gdbarch, ARM_NUM_REGS);
set_gdbarch_register_type (gdbarch, arm_register_type);
set_gdbarch_register_reggroup_p (gdbarch, arm_register_reggroup_p);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* This "info float" is FPA-specific. Use the generic version if we
do not have FPA. */
if (gdbarch_tdep (gdbarch)->have_fpa_registers)
set_gdbarch_print_float_info (gdbarch, arm_print_float_info);
/* Internal <-> external register number maps. */
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, arm_dwarf_reg_to_regnum);
set_gdbarch_register_sim_regno (gdbarch, arm_register_sim_regno);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
set_gdbarch_register_name (gdbarch, arm_register_name);
/* Returning results. */
set_gdbarch_return_value (gdbarch, arm_return_value);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* Disassembly. */
set_gdbarch_print_insn (gdbarch, gdb_print_insn_arm);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* Minsymbol frobbing. */
set_gdbarch_elf_make_msymbol_special (gdbarch, arm_elf_make_msymbol_special);
set_gdbarch_coff_make_msymbol_special (gdbarch,
arm_coff_make_msymbol_special);
set_gdbarch_record_special_symbol (gdbarch, arm_record_special_symbol);
* arm-tdep.h: New file. * arm-tdep.c: Include arm-tdep.h. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Make static. (arm_software_single_step): Similarly. Fix types in declaration. (arm_register_byte, arm_register_raw_size, arm_register_virtual_size) (arm_store_return_value, arm_store_struct_return): New functions. (arm_gdbarch_init): Register the above functions. Also register call_dummy_start_offset, sizeof_call_dummy_words, function_start_offset, inner_than, decr_pc_after_break, fp_regnum, sp_regnum, pc_regnum, register_bytes, num_regs, max_register_raw_size, max_register_virtual_size, register_size. Set up prologue_cache.saved_regs here, rather than ... (_initialize_arm_tdep): ... here. * config/arm/tm-arm.h (struct type, struct value): Delete forward declarations. (arm_addr_bits_remove, arm_smash_text_address, arm_saved_pc_after_call) (arm_skip_prologue, arm_call_dummy_words, arm_fix_call_dummy) (arm_print_float_info, arm_register_type, convert_to_extended) (arm_elf_make_msymbols_special, arm_coff_make_msymbol_special) (arm_extract_return_value, arm_register_name): Delete declarations. (SMASH_TEXT_ADDRESS, ADDR_BITS_REMOVE, FUNCTION_START_OFFSET) (SKIP_PROLOGUE, SAVED_PC_AFTER_CALL, INNER_THAN, BREAKPOINT_FROM_PC) (DECR_PC_AFTER_BREAK, PRINT_FLOAT_INFO, REGISTER_SIZE, NUM_REGS) (REGISTER_NAME, REGISTER_BYTES, REGISTER_BYTE, REGISTER_RAW_SIZE) (REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE) (MAX_REGISTER_VIRTUAL_SIZE, REGISTER_VIRTUAL_TYPE, STORE_STRUCT_RETURN) (EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE, CALL_DUMMY_WORDS) (SIZEOF_CALL_DUMMY_WORDS, CALL_DUMMY_START_OFFSET, FIX_CALL_DUMMY) (SOFTWARE_SINGLE_STEP_P, SOFTWARE_SINGLE_STEP) (ELF_MAKE_MSYMBOL_SPECIAL, COFF_MAKE_MSYMBOL_SPECIAL) Delete. (arm_pc_is_thumb, arm_pc_is_thumb_dummy, thumb_get_next_pc) (arm_get_next_pc): No-longer static -- these are needed by the RDI interface. * arm-linux-nat.c arm-linux-tdep.c armnbsd-nat.c: Include arm-tdep.h. * remote-rdi.c remote-rdp.c: Likewise. * Makefile.in (arm-linux-nat.o, arm-linux-tdep.o arm-tdep.o) (armnbsd-nat.o, remote-rdi.o, remote_rdp.o): Update dependencies. * config/arm/tm-nbsd.h (SOFTWARE_SINGLE_STEP_P): Delete bogus definition. * arm-tdep.h (ARM_A1_REGNUM, ARM_A4_REGNUM, ARM_AP_REGNUM) (ARM_SP_REGNUM, ARM_LR_REGNUM, ARM_PC_REGNUM, ARM_F0_REGNUM) (ARM_F3_REGNUM, ARM_F7_REGNUM, ARM_FPS_REGNUM, ARM_PS_REGNUM): Renamed from non-ARM_ prefixed definitions. * arm-tdep.c armnbsd-nat.c arm-linux-nat.c arm-linux-tdep.c: Update all uses of above. * remote-rdi.c remote-rdp.c: Likewise. * arm-linux-nat.c (ARM_CPSR_REGNUM): Renamed from CPSR_REGNUM.
2002-02-11 19:34:12 +01:00
/* Thumb-2 IT block support. */
set_gdbarch_adjust_breakpoint_address (gdbarch,
arm_adjust_breakpoint_address);
* NEWS: Mention pointer to member improvements. * Makefile.in (gnu-v3-abi.o): Delete special rule. (eval.o, gnu-v3-abi.o, ia64-tdep.o): Update. * ada-valprint.c (ada_print_scalar): Update for new type codes. * c-typeprint.c (c_print_type): Update for new type codes. (c_type_print_varspec_prefix, c_type_print_varspec_suffix) (c_type_print_base): Likewise. (c_type_print_args): Rewrite. * c-valprint.c (c_val_print): Update for new type codes. Remove support for references to members. Treat methods like functions. * cp-abi.c (cplus_print_method_ptr, cplus_method_ptr_size) (cplus_make_method_ptr, cplus_method_ptr_to_value): New. * cp-abi.h (cplus_print_method_ptr, cplus_method_ptr_size) (cplus_make_method_ptr, cplus_method_ptr_to_value): New prototypes. (struct cp_abi_ops): Add corresponding members. * cp-valprint.c (cp_print_class_method): Delete. (cp_find_class_member): New function. (cp_print_class_member): Use it. Simplify support for bogus member pointers. * dwarf2read.c (quirk_gcc_member_function_pointer): Use lookup_methodptr_type. (read_tag_ptr_to_member_type): Likewise, and lookup_memberptr_type. * eval.c (evaluate_subexp_standard): Implement EVAL_SKIP for OP_SCOPE. Update call to value_aggregate_elt. Rewrite member pointer support. (evaluate_subexp_for_address): Handle OP_SCOPE explicitly. Handle references returned by user defined operators. * f-typeprint.c (f_print_type, f_type_print_varspec_prefix) (f_type_print_varspec_suffix): Remove support for member pointers. * gdbtypes.c (lookup_memberptr_type): Renamed from lookup_member_type and adjusted. (smash_to_memberptr_type): Likewise, from smash_to_member_type. (lookup_methodptr_type): New. (rank_one_type): Adjust for TYPE_CODE_MEMBERPTR. (recursive_dump_type): Update for new types. * gdbtypes.h (enum type_code): Replace TYPE_CODE_MEMBER with TYPE_CODE_MEMBERPTR and TYPE_CODE_METHODPTR. (lookup_memberptr_type, lookup_methodptr_type) (smash_to_memberptr_type): New prototypes. (smash_to_method_type): Formatting fix. (lookup_member_type, smash_to_member_type): Delete prototypes. * gnu-v3-abi.c (gnuv3_get_vtable, gnuv3_get_virtual_fn): New. Do not rely on debug information for the vptr or the method's enclosing type. Handle function descriptors for IA64. (gnuv3_virtual_fn_field): Rewrite using the new functions. (gnuv3_find_method_in, gnuv3_print_method_ptr) (gnuv3_method_ptr_size, gnuv3_make_method_ptr) (gnuv3_method_ptr_to_value): New. (init_gnuv3_ops): Set new members of gnu_v3_abi_ops. * hpread.c (hpread_type_lookup): Update for new types. * infcall.c (value_arg_coerce): Likewise. * m2-typeprint.c (m2_print_type): Remove explicit support for member pointers. * m2-valprint.c (m2_val_print): Likewise. * p-typeprint.c (pascal_type_print_varspec_prefix) (pascal_type_print_varspec_suffix, pascal_type_print_base): Likewise. * p-valprint.c (pascal_val_print): Likewise. (pascal_object_print_class_method, pascal_object_print_class_member): Delete. * p-lang.h (pascal_object_print_class_method) (pascal_object_print_class_member): Delete prototypes. * stabsread.c (read_type): Update for new types. * typeprint.c (print_type_scalar): Likewise. * valops.c (value_struct_elt_for_reference, value_namespace_elt) (value_maybe_namespace_elt, value_aggregate_elt): Add want_address argument. Construct a pointer to member if the address of a function or data member is requested. (value_cast_pointers): Don't modify the input value. (value_cast): Adjust pointer to member handling for new types. Allow null pointer to member constants. Don't modify the input value. (value_ind): Remove pointer to member check. Handle function descriptors for function pointers. (value_struct_elt, value_find_oload_method_list, check_field): Remove pointer to member checks. * value.c (unpack_long): Allow pointers to data members. (value_from_longest): Allow member pointers. * value.h (value_aggregate_elt): Add want_address. * varobj.c (c_variable_editable): Remove check for members. * gdbarch.sh: Add vtable_function_descriptors and vbit_in_delta. * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Handle descriptors in virtual tables. (ia64_gdbarch_init): Call set_gdbarch_vtable_function_descriptors. * c-lang.h (cp_print_class_method): Delete prototype. * arm-tdep.c (arm_gdbarch_init): Call set_gdbarch_vbit_in_delta. * mips-tdep.c (mips_gdbarch_init): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * gdb.cp/classes.exp (test_pointers_to_class_members): Update expected output. Test the types of members and member pointers. * gdb.cp/inherit.exp (test_print_mi_member_types): Remove KFAILs for gdb/2092. * gdb.cp/member-ptr.exp: Search for a comment instead of a statement. Enable for GCC. Update expected output for some tests and add new tests. Remove obsolete GCC KFAILs. Allow GCC's class layout. * gdb.cp/member-ptr.cc (Padding, Padding::vspacer, Base, Base::get_x) (Base::vget_base, Left, Left::vget, Right, Right::vget, Diamond) (Diamond::vget_base): New. (main): Add new tests. * gdb.cp/printmethod.exp: Update expected output for member functions. * gdb.cp/virtfunc.exp (test_virtual_calls): Add a KFAIL for print pEe->D::vg().
2007-01-03 19:05:45 +01:00
/* Virtual tables. */
set_gdbarch_vbit_in_delta (gdbarch, 1);
/* Hook in the ABI-specific overrides, if they have been registered. */
gdbarch_init_osabi (info, gdbarch);
dwarf2_frame_set_init_reg (gdbarch, arm_dwarf2_frame_init_reg);
/* Add some default predicates. */
if (is_m)
frame_unwind_append_unwinder (gdbarch, &arm_m_exception_unwind);
frame_unwind_append_unwinder (gdbarch, &arm_stub_unwind);
dwarf2_append_unwinders (gdbarch);
frame_unwind_append_unwinder (gdbarch, &arm_exidx_unwind);
Add arm epilogue unwinder Nowadays, GDB can't unwind successfully from epilogue on arm, (gdb) bt #0 0x76ff65a2 in shr1 () from /home/yao/Source/gnu/build/gdb/testsuite/gdb.reverse/shr1.sl #1 0x0000869e in main () at /home/yao/Source/gnu/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.reverse/solib-reverse.c:34 Backtrace stopped: previous frame inner to this frame (corrupt stack?) (gdb) disassemble shr1 Dump of assembler code for function shr1: .... 0x76ff659a <+10>: adds r7, #12 0x76ff659c <+12>: mov sp, r7 0x76ff659e <+14>: ldr.w r7, [sp], #4 0x76ff65a2 <+18>: bx lr End of assembler dump. in this case, prologue unwinder is used. It analyzes the prologue and get the offsets of saved registers to SP. However, in epilogue, the SP has been restored, prologue unwinder gets the registers from the wrong address, and even the frame id is wrong. In reverse debugging, this case (program stops at the last instruction of function) happens quite frequently due to the reverse execution. There are many test fails due to missing epilogue unwinder. This adds epilogue unwinder, but the frame cache is still get by prologue unwinder except that SP is fixed up separately, because SP is restored in epilogue. This patch fixes many fails in solib-precsave.exp, and solib-reverse.exp. gdb: 2016-03-30 Yao Qi <yao.qi@linaro.org> * arm-tdep.c: (arm_make_epilogue_frame_cache): New function. (arm_epilogue_frame_this_id): New function. (arm_epilogue_frame_prev_register): New function. (arm_epilogue_frame_sniffer): New function. (arm_epilogue_frame_unwind): New. (arm_gdbarch_init): Append unwinder arm_epilogue_frame_unwind.
2016-03-30 17:44:24 +02:00
frame_unwind_append_unwinder (gdbarch, &arm_epilogue_frame_unwind);
frame_unwind_append_unwinder (gdbarch, &arm_prologue_unwind);
/* Now we have tuned the configuration, set a few final things,
based on what the OS ABI has told us. */
/* If the ABI is not otherwise marked, assume the old GNU APCS. EABI
binaries are always marked. */
if (tdep->arm_abi == ARM_ABI_AUTO)
tdep->arm_abi = ARM_ABI_APCS;
ChangeLog: * arm-linux-nat.c: Include "observer.h" and "gdbthread.h". (PTRACE_GETHBPREGS, PTRACE_SETHBPREGS): Define. (struct arm_linux_hwbp_cap): New type. (arm_linux_get_hwbp_cap): New function. (arm_linux_get_hw_breakpoint_count): Likewise. (arm_linux_get_hw_watchpoint_count): Likewise. (arm_linux_can_use_hw_breakpoint): Likewise. (arm_hwbp_type): New type. (arm_hwbp_control_t): Likewise. (struct arm_linux_hw_breakpoint): Likewise. (struct arm_linux_thread_points): Likewise. (arm_threads): New global variable. (arm_linux_find_breakpoints_by_tid): New function. (arm_hwbp_control_initialize): Likewise. (arm_hwbp_control_is_enabled): Likewise. (arm_hwbp_control_disable): Likewise. (arm_linux_hw_breakpoint_initialize): Likewise. (arm_linux_get_hwbp_type): Likewise. (arm_linux_hw_watchpoint_initialize): Likewise. (arm_linux_hw_breakpoint_equal): Likewise. (arm_linux_insert_hw_breakpoint1): Likewise. (arm_linux_remove_hw_breakpoint1): Likewise. (arm_linux_insert_hw_breakpoint): Likewise. (arm_linux_remove_hw_breakpoint): Likewise. (arm_linux_region_ok_for_hw_watchpoint): Likewise. (arm_linux_insert_watchpoint): Likewise. (arm_linux_remove_watchpoint): Likewise. (arm_linux_stopped_data_address): Likewise. (arm_linux_stopped_by_watchpoint): Likewise. (arm_linux_watchpoint_addr_within_range): Likewise. (arm_linux_new_thread): Likewise. (arm_linux_thread_exit): Likewise. (_initialize_arm_linux_nat): Install hardware breakpoint/watchpoint related target callbacks. Register arm_linux_new_thread and arm_linux_thread_exit. * arm-tdep.h (arm_pc_is_thumb): Add prototype. * arm-tdep.c (arm_pc_is_thumb): Make global. (arm_gdbarch_init): Call set_gdbarch_have_nonsteppable_watchpoint. testsuite/ChangeLog: * lib/gdb.exp (skip_hw_breakpoint_tests): Add arm*-*-* target. (skip_hw_watchpoint_tests): Likewise. (skip_hw_watchpoint_multi_tests): Likewise.
2011-02-21 16:03:38 +01:00
/* Watchpoints are not steppable. */
set_gdbarch_have_nonsteppable_watchpoint (gdbarch, 1);
/* We used to default to FPA for generic ARM, but almost nobody
uses that now, and we now provide a way for the user to force
the model. So default to the most useful variant. */
if (tdep->fp_model == ARM_FLOAT_AUTO)
tdep->fp_model = ARM_FLOAT_SOFT_FPA;
if (tdep->jb_pc >= 0)
set_gdbarch_get_longjmp_target (gdbarch, arm_get_longjmp_target);
/* Floating point sizes and format. */
* doublest.c (floatformat_from_length): Use the right element from gdbarch floatformats. (floatformat_from_type, extract_typed_floating) (store_typed_floating): Likewise. * doublest.h: Remove declarations for undefined floatformat arrays. * gdbarch.sh (float_format, double_format, long_double_format): Change to pairs. (pformat): Update for pairs. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double) (floatformats_ieee_double_littlebyte_bigword) (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext) (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f) (floatformats_vax_d): New variables. (builtin_type_ieee_single, builtin_type_ieee_double) (builtin_type_arm_ext, builtin_type_ia64_spill) (builtin_type_ia64_quad): Replace arrays with individual types. (builtin_type_ieee_single_big, builtin_type_ieee_single_little) (builtin_type_ieee_double_big, builtin_type_ieee_double_little) (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext) (builtin_type_m88110_ext, builtin_type_m88110_harris_ext) (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword) (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little) (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete unused and endian-specific types. (recursive_dump_type): Update for floatformat pairs. (build_flt): Move higher. Handle bit == -1. Take a floatformat pair. (build_gdbtypes): Use build_flt. (_initialize_gdbtypes): Update set of initialized types. * gdbtypes.h: Update declarations to match gdbtypes.c. (struct main_type): Store a pointer to two floatformats. * arch-utils.c (default_float_format, default_double_format): Delete. * arch-utils.h (default_float_format, default_double_format): Delete. * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c, ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c, vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
set_gdbarch_float_format (gdbarch, floatformats_ieee_single);
if (tdep->fp_model == ARM_FLOAT_SOFT_FPA || tdep->fp_model == ARM_FLOAT_FPA)
{
* doublest.c (floatformat_from_length): Use the right element from gdbarch floatformats. (floatformat_from_type, extract_typed_floating) (store_typed_floating): Likewise. * doublest.h: Remove declarations for undefined floatformat arrays. * gdbarch.sh (float_format, double_format, long_double_format): Change to pairs. (pformat): Update for pairs. * gdbarch.c, gdbarch.h: Regenerated. * gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double) (floatformats_ieee_double_littlebyte_bigword) (floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext) (floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f) (floatformats_vax_d): New variables. (builtin_type_ieee_single, builtin_type_ieee_double) (builtin_type_arm_ext, builtin_type_ia64_spill) (builtin_type_ia64_quad): Replace arrays with individual types. (builtin_type_ieee_single_big, builtin_type_ieee_single_little) (builtin_type_ieee_double_big, builtin_type_ieee_double_little) (builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext) (builtin_type_m88110_ext, builtin_type_m88110_harris_ext) (builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword) (builtin_type_ia64_spill_big, builtin_type_ia64_spill_little) (builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete unused and endian-specific types. (recursive_dump_type): Update for floatformat pairs. (build_flt): Move higher. Handle bit == -1. Take a floatformat pair. (build_gdbtypes): Use build_flt. (_initialize_gdbtypes): Update set of initialized types. * gdbtypes.h: Update declarations to match gdbtypes.c. (struct main_type): Store a pointer to two floatformats. * arch-utils.c (default_float_format, default_double_format): Delete. * arch-utils.h (default_float_format, default_double_format): Delete. * arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c, ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c, mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c, sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c, vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 18:31:06 +01:00
set_gdbarch_double_format
(gdbarch, floatformats_ieee_double_littlebyte_bigword);
set_gdbarch_long_double_format
(gdbarch, floatformats_ieee_double_littlebyte_bigword);
}
else
{
set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
}
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
if (have_vfp_pseudos)
{
/* NOTE: These are the only pseudo registers used by
the ARM target at the moment. If more are added, a
little more care in numbering will be needed. */
int num_pseudos = 32;
if (have_neon_pseudos)
num_pseudos += 16;
set_gdbarch_num_pseudo_regs (gdbarch, num_pseudos);
set_gdbarch_pseudo_register_read (gdbarch, arm_pseudo_read);
set_gdbarch_pseudo_register_write (gdbarch, arm_pseudo_write);
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
if (tdesc_data)
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
{
set_tdesc_pseudo_register_name (gdbarch, arm_register_name);
tdesc_use_registers (gdbarch, tdesc, tdesc_data);
* NEWS: Mention ARM VFP support. * target-descriptions.c (tdesc_register_type): Make public. (tdesc_unnumbered_register): New function. (tdesc_register_reggroup_p): Allow missing pseudo_register_reggroup_p. * target-descriptions.h (tdesc_register_type): Declare. (tdesc_unnumbered_register): Declare. * arm-tdep.c (arm_neon_quad_read, arm_neon_quad_write): New functions. (arm_push_dummy_call): Use arm_neon_quad_write. (arm_neon_double_type, arm_neon_quad_type): New functions. (arm_register_type): Handle VFP and NEON registers. Override the types of double-precision registers for NEON. Disable FPA registers if they are not present. (arm_dwarf_reg_to_regnum): Add current VFP and NEON register numbers. (arm_return_value): Use arm_neon_quad_write and arm_neon_quad_read. (arm_register_name): Handle VFP single and NEON quad registers. (arm_pseudo_read, arm_pseudo_write): New functions. (arm_gdbarch_init): Check for VFP and NEON in the target description. Assign numbers to double-precision registers. Register VFP and NEON pseudo registers. Remove a shadowed "i" variable. * arm-tdep.h (enum gdb_regnum): Add ARM_D0_REGNUM and ARM_D31_REGNUM. (struct gdbarch_tdep): Add have_neon_pseudos, have_neon, have_vfp_registers, have_vfp_pseudos, neon_double_type, and neon_quad_type. * features/Makefile: Make expedite settings only architecture specific. (WHICH): Add new ARM descriptions. * features/arm-with-neon.xml, features/arm-with-vfpv2.c, features/arm-with-vfpv3.c, features/arm-vfpv2.xml, features/arm-vfpv3.xml, features/arm-with-vfpv2.xml, features/arm-with-vfpv3.xml, features/arm-with-neon.c: New files. * regformats/arm-with-neon.dat, regformats/arm-with-vfpv2.dat, regformats/arm-with-vfpv3.dat: Generate. doc/ * gdb.texinfo (ARM Features): Document org.gnu.gdb.arm.vfp and org.gnu.gdb.arm.neon. gdbserver/ * linux-low.c (linux_write_memory): Update debugging output. * Makefile.in (clean): Add new descriptions. (arm-with-vfpv2.o, arm-with-vfpv2.c, arm-with-vfpv3.o) (arm-with-vfpv3.c, arm-with-neon.o, arm-with-neon.c): New rules. * configure.srv: Add new files for arm*-*-linux*. * linux-arm-low.c: Add new declarations. (PTRACE_GETVFPREGS, PTRACE_SETVFPREGS): Define if undefined. (arm_hwcap, HWCAP_VFP, HWCAP_IWMMXT, HWCAP_NEON, HWCAP_VFPv3) (HWCAP_VFPv3D16): New. (arm_fill_wmmxregset, arm_store_wmmxregset): Check HWCAP_IWMMXT instead of __IWMMXT__. (arm_fill_vfpregset, arm_store_vfpregset, arm_get_hwcap) (arm_arch_setup): New. (target_regsets): Remove #ifdef. Add VFP regset. (the_low_target): Use arm_arch_setup. testsuite/ * gdb.base/float.exp: Handle VFP registers.
2009-07-28 20:26:51 +02:00
/* Override tdesc_register_type to adjust the types of VFP
registers for NEON. */
set_gdbarch_register_type (gdbarch, arm_register_type);
}
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
/* Add standard register aliases. We add aliases even for those
[gdb] Fix more typos in comments Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
names which are used by the current architecture - it's simpler,
* Makefile.in (arm-tdep.o, eval.o, target-descriptions.o) (xml-tdesc.o): Update. * xml-support.c: Add a comment. (gdb_xml_enums_boolean): New variable. (gdb_xml_parse_attr_enum): Use strcasecmp. * xml-support.h (gdb_xml_enums_boolean): Declare. * xml-tdesc.c (struct tdesc_parsing_data): Record current_feature, next_regnum, and current_union. (tdesc_start_feature, tdesc_start_reg, tdesc_start_union) (tdesc_end_union, tdesc_start_field, tdesc_start_vector) (field_attributes, union_children, reg_attributes, union_attributes) (vector_attributes, feature_attributes, feature_children): New. (target_children): Make static. Add <feature>. (tdesc_elements): Make static. * target-descriptions.c (struct tdesc_reg, tdesc_reg_p, type_p) (struct tdesc_feature, tdesc_feature_p): New types. (struct target_desc): Add features member. (struct tdesc_arch_data, tdesc_data): New. (target_find_description): Clarify error message. Warn about ignored register descriptions. (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_data_init, tdesc_data_alloc) (tdesc_data_cleanup, tdesc_numbered_register) (tdesc_numbered_register_choices, tdesc_find_register) (tdesc_register_name, tdesc_register_type) (tdesc_remote_register_number, tdesc_register_reggroup_p) (set_tdesc_pseudo_register_name, set_tdesc_pseudo_register_type) (set_tdesc_pseudo_register_reggroup_p, tdesc_use_registers) (tdesc_free_reg, tdesc_create_reg, tdesc_free_feature) (tdesc_create_feature, tdesc_record_type): New. (free_target_description): Free features. (_initialize_target_descriptions): Initialize tdesc_data. * arch-utils.c (default_remote_register_number): New. * arch-utils.h (default_remote_register_number): New prototype. * target-descriptions.h (set_tdesc_pseudo_register_name) (set_tdesc_pseudo_register_type, set_tdesc_pseudo_register_reggroup_p) (tdesc_use_registers, tdesc_data_alloc, tdesc_data_cleanup) (tdesc_numbered_register, tdesc_numbered_register_choices) (tdesc_has_registers, tdesc_find_feature, tdesc_feature_name) (tdesc_named_type, tdesc_create_feature, tdesc_record_type) (tdesc_create_reg): Declare. * gdbarch.sh (remote_register_number): New entry. * gdbarch.c, gdbarch.h: Regenerate. * remote.c (init_remote_state): Use gdbarch_remote_register_number. * features/gdb-target.dtd: Add feature, reg, vector, union, and field. * arm-tdep.c (arm_register_aliases): New. (arm_register_name_strings): Rename to... (arm_register_names): ...this. Make const. Delete the old version. (current_option, arm_register_byte): Delete. (set_disassembly_style): Simplify. Do not adjust arm_register_names. (value_of_arm_user_reg): New. (arm_gdbarch_init): Verify any described registers. Call tdesc_use_registers. Don't use arm_register_byte. Create aliases for standard register names. (_initialize_arm_tdep): Do not adjust arm_register_names. * user-regs.c (struct user_reg): Add baton member. (append_user_reg, user_reg_add_builtin, user_regs_init) (user_reg_add, value_of_user_reg): Use a baton for user register functions. * std-regs.c: Update. * user-regs.h (user_reg_read_ftype, user_reg_add_builtin) (user_reg_add): Add baton argument. * NEWS: Mention target description register support. * features/arm-core.xml, features/arm-fpa.xml: New. * eval.c (evaluate_subexp_standard): Allow ptype $register when the program is not running. * gdb.texinfo (-target-disconnect): Use @smallexample. (Requirements): Add anchor for Expat. Update description. (Target Descriptions): Mention Expat. (Target Description Format): Document new elements. Use @smallexample. (Predefined Target Types, Standard Target Features): New sections. * doc/gdbint.texinfo (Target Descriptions): New section. * gdb.xml/single-reg.xml, gdb.xml/tdesc-regs.exp, gdb.xml/core-only.xml, gdb.xml/extra-regs.xml: New files.
2007-02-08 22:00:36 +01:00
and does no harm, since nothing ever lists user registers. */
for (i = 0; i < ARRAY_SIZE (arm_register_aliases); i++)
user_reg_add (gdbarch, arm_register_aliases[i].name,
value_of_arm_user_reg, &arm_register_aliases[i].regnum);
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
set_gdbarch_disassembler_options (gdbarch, &arm_disassembler_options);
set_gdbarch_valid_disassembler_options (gdbarch, disassembler_options_arm ());
set_gdbarch_gnu_triplet_regexp (gdbarch, arm_gnu_triplet_regexp);
return gdbarch;
}
static void
arm_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (tdep == NULL)
return;
fprintf_unfiltered (file, _("arm_dump_tdep: fp_model = %i\n"),
(int) tdep->fp_model);
fprintf_unfiltered (file, _("arm_dump_tdep: have_fpa_registers = %i\n"),
(int) tdep->have_fpa_registers);
fprintf_unfiltered (file, _("arm_dump_tdep: have_wmmx_registers = %i\n"),
(int) tdep->have_wmmx_registers);
fprintf_unfiltered (file, _("arm_dump_tdep: vfp_register_count = %i\n"),
(int) tdep->vfp_register_count);
fprintf_unfiltered (file, _("arm_dump_tdep: have_vfp_pseudos = %i\n"),
(int) tdep->have_vfp_pseudos);
fprintf_unfiltered (file, _("arm_dump_tdep: have_neon_pseudos = %i\n"),
(int) tdep->have_neon_pseudos);
fprintf_unfiltered (file, _("arm_dump_tdep: have_neon = %i\n"),
(int) tdep->have_neon);
fprintf_unfiltered (file, _("arm_dump_tdep: Lowest pc = 0x%lx\n"),
(unsigned long) tdep->lowest_pc);
}
#if GDB_SELF_TEST
namespace selftests
{
static void arm_record_test (void);
}
#endif
gdb: add back declarations for _initialize functions I'd like to enable the -Wmissing-declarations warning. However, it warns for every _initialize function, for example: CXX dcache.o /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’: /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations] _initialize_dcache (void) ^~~~~~~~~~~~~~~~~~ The only practical way forward I found is to add back the declarations, which were removed by this commit: commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9 Author: John Baldwin <jhb@FreeBSD.org> Date: Sat Sep 9 11:02:37 2017 -0700 Remove unnecessary function prototypes. I don't think it's a big problem to have the declarations for these functions, but if anybody has a better solution for this, I'll be happy to use it. gdb/ChangeLog: * aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration. * aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration. * aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration. * aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration. * aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration. * aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration. * ada-exp.y (_initialize_ada_exp): Add declaration. * ada-lang.c (_initialize_ada_language): Add declaration. * ada-tasks.c (_initialize_tasks): Add declaration. * agent.c (_initialize_agent): Add declaration. * aix-thread.c (_initialize_aix_thread): Add declaration. * alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration. * alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. * amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration. * amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration. * amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration. * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration. * amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration. * amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration. * amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration. * amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration. * amd64-tdep.c (_initialize_amd64_tdep): Add declaration. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration. * amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration. * annotate.c (_initialize_annotate): Add declaration. * arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration. * arc-tdep.c (_initialize_arc_tdep): Add declaration. * arch-utils.c (_initialize_gdbarch_utils): Add declaration. * arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration. * arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration. * arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration. * arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration. * arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration. * arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration. * arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration. * arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration. * auto-load.c (_initialize_auto_load): Add declaration. * auxv.c (_initialize_auxv): Add declaration. * avr-tdep.c (_initialize_avr_tdep): Add declaration. * ax-gdb.c (_initialize_ax_gdb): Add declaration. * bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration. * bfin-tdep.c (_initialize_bfin_tdep): Add declaration. * break-catch-sig.c (_initialize_break_catch_sig): Add declaration. * break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration. * break-catch-throw.c (_initialize_break_catch_throw): Add declaration. * breakpoint.c (_initialize_breakpoint): Add declaration. * bsd-uthread.c (_initialize_bsd_uthread): Add declaration. * btrace.c (_initialize_btrace): Add declaration. * charset.c (_initialize_charset): Add declaration. * cli/cli-cmds.c (_initialize_cli_cmds): Add declaration. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-logging.c (_initialize_cli_logging): Add declaration. * cli/cli-script.c (_initialize_cli_script): Add declaration. * cli/cli-style.c (_initialize_cli_style): Add declaration. * coff-pe-read.c (_initialize_coff_pe_read): Add declaration. * coffread.c (_initialize_coffread): Add declaration. * compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration. * compile/compile.c (_initialize_compile): Add declaration. * complaints.c (_initialize_complaints): Add declaration. * completer.c (_initialize_completer): Add declaration. * copying.c (_initialize_copying): Add declaration. * corefile.c (_initialize_core): Add declaration. * corelow.c (_initialize_corelow): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * cp-namespace.c (_initialize_cp_namespace): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-valprint.c (_initialize_cp_valprint): Add declaration. * cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration. * cris-tdep.c (_initialize_cris_tdep): Add declaration. * csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration. * csky-tdep.c (_initialize_csky_tdep): Add declaration. * ctfread.c (_initialize_ctfread): Add declaration. * d-lang.c (_initialize_d_language): Add declaration. * darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration. * darwin-nat.c (_initialize_darwin_nat): Add declaration. * dbxread.c (_initialize_dbxread): Add declaration. * dcache.c (_initialize_dcache): Add declaration. * disasm-selftests.c (_initialize_disasm_selftests): Add declaration. * disasm.c (_initialize_disasm): Add declaration. * dtrace-probe.c (_initialize_dtrace_probe): Add declaration. * dummy-frame.c (_initialize_dummy_frame): Add declaration. * dwarf-index-cache.c (_initialize_index_cache): Add declaration. * dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration. * dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration. * dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration. * dwarf2expr.c (_initialize_dwarf2expr): Add declaration. * dwarf2loc.c (_initialize_dwarf2loc): Add declaration. * dwarf2read.c (_initialize_dwarf2_read): Add declaration. * elfread.c (_initialize_elfread): Add declaration. * exec.c (_initialize_exec): Add declaration. * extension.c (_initialize_extension): Add declaration. * f-lang.c (_initialize_f_language): Add declaration. * f-valprint.c (_initialize_f_valprint): Add declaration. * fbsd-nat.c (_initialize_fbsd_nat): Add declaration. * fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration. * filesystem.c (_initialize_filesystem): Add declaration. * findcmd.c (_initialize_mem_search): Add declaration. * findvar.c (_initialize_findvar): Add declaration. * fork-child.c (_initialize_fork_child): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (_initialize_frame): Add declaration. * frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration. * frv-tdep.c (_initialize_frv_tdep): Add declaration. * ft32-tdep.c (_initialize_ft32_tdep): Add declaration. * gcore.c (_initialize_gcore): Add declaration. * gdb-demangle.c (_initialize_gdb_demangle): Add declaration. * gdb_bfd.c (_initialize_gdb_bfd): Add declaration. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration. * gdbarch.c (_initialize_gdbarch): Add declaration. * gdbtypes.c (_initialize_gdbtypes): Add declaration. * gnu-nat.c (_initialize_gnu_nat): Add declaration. * gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration. * gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration. * go-lang.c (_initialize_go_language): Add declaration. * go32-nat.c (_initialize_go32_nat): Add declaration. * guile/guile.c (_initialize_guile): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration. * hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration. * hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration. * hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration. * hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration. * hppa-tdep.c (_initialize_hppa_tdep): Add declaration. * i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration. * i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration. * i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration. * i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration. * i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration. * i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration. * i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration. * i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration. * i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration. * i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration. * i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration. * i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration. * i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration. * i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration. * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration. * i386-tdep.c (_initialize_i386_tdep): Add declaration. * i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration. * ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration. * ia64-tdep.c (_initialize_ia64_tdep): Add declaration. * ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration. * infcall.c (_initialize_infcall): Add declaration. * infcmd.c (_initialize_infcmd): Add declaration. * inflow.c (_initialize_inflow): Add declaration. * infrun.c (_initialize_infrun): Add declaration. * interps.c (_initialize_interpreter): Add declaration. * iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration. * jit.c (_initialize_jit): Add declaration. * language.c (_initialize_language): Add declaration. * linux-fork.c (_initialize_linux_fork): Add declaration. * linux-nat.c (_initialize_linux_nat): Add declaration. * linux-tdep.c (_initialize_linux_tdep): Add declaration. * linux-thread-db.c (_initialize_thread_db): Add declaration. * lm32-tdep.c (_initialize_lm32_tdep): Add declaration. * m2-lang.c (_initialize_m2_language): Add declaration. * m32c-tdep.c (_initialize_m32c_tdep): Add declaration. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration. * m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration. * m32r-tdep.c (_initialize_m32r_tdep): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. * m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration. * m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration. * m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration. * m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * machoread.c (_initialize_machoread): Add declaration. * macrocmd.c (_initialize_macrocmd): Add declaration. * macroscope.c (_initialize_macroscope): Add declaration. * maint-test-options.c (_initialize_maint_test_options): Add declaration. * maint-test-settings.c (_initialize_maint_test_settings): Add declaration. * maint.c (_initialize_maint_cmds): Add declaration. * mdebugread.c (_initialize_mdebugread): Add declaration. * memattr.c (_initialize_mem): Add declaration. * mep-tdep.c (_initialize_mep_tdep): Add declaration. * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration. * mi/mi-cmds.c (_initialize_mi_cmds): Add declaration. * mi/mi-interp.c (_initialize_mi_interp): Add declaration. * mi/mi-main.c (_initialize_mi_main): Add declaration. * microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration. * microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration. * mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration. * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration. * mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration. * mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration. * mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration. * mipsread.c (_initialize_mipsread): Add declaration. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration. * mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration. * moxie-tdep.c (_initialize_moxie_tdep): Add declaration. * msp430-tdep.c (_initialize_msp430_tdep): Add declaration. * nds32-tdep.c (_initialize_nds32_tdep): Add declaration. * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration. * nios2-tdep.c (_initialize_nios2_tdep): Add declaration. * nto-procfs.c (_initialize_procfs): Add declaration. * objc-lang.c (_initialize_objc_language): Add declaration. * observable.c (_initialize_observer): Add declaration. * opencl-lang.c (_initialize_opencl_language): Add declaration. * or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration. * or1k-tdep.c (_initialize_or1k_tdep): Add declaration. * osabi.c (_initialize_gdb_osabi): Add declaration. * osdata.c (_initialize_osdata): Add declaration. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * parse.c (_initialize_parse): Add declaration. * ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration. * ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration. * ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration. * ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration. * printcmd.c (_initialize_printcmd): Add declaration. * probe.c (_initialize_probe): Add declaration. * proc-api.c (_initialize_proc_api): Add declaration. * proc-events.c (_initialize_proc_events): Add declaration. * proc-service.c (_initialize_proc_service): Add declaration. * procfs.c (_initialize_procfs): Add declaration. * producer.c (_initialize_producer): Add declaration. * psymtab.c (_initialize_psymtab): Add declaration. * python/python.c (_initialize_python): Add declaration. * ravenscar-thread.c (_initialize_ravenscar): Add declaration. * record-btrace.c (_initialize_record_btrace): Add declaration. * record-full.c (_initialize_record_full): Add declaration. * record.c (_initialize_record): Add declaration. * regcache-dump.c (_initialize_regcache_dump): Add declaration. * regcache.c (_initialize_regcache): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * remote-notif.c (_initialize_notif): Add declaration. * remote-sim.c (_initialize_remote_sim): Add declaration. * remote.c (_initialize_remote): Add declaration. * reverse.c (_initialize_reverse): Add declaration. * riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration. * riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration. * riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration. * riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration. * riscv-tdep.c (_initialize_riscv_tdep): Add declaration. * rl78-tdep.c (_initialize_rl78_tdep): Add declaration. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration. * rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep): Add declaration. * rs6000-nat.c (_initialize_rs6000_nat): Add declaration. * rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration. * run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration. * rust-exp.y (_initialize_rust_exp): Add declaration. * rx-tdep.c (_initialize_rx_tdep): Add declaration. * s12z-tdep.c (_initialize_s12z_tdep): Add declaration. * s390-linux-nat.c (_initialize_s390_nat): Add declaration. * s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration. * s390-tdep.c (_initialize_s390_tdep): Add declaration. * score-tdep.c (_initialize_score_tdep): Add declaration. * ser-go32.c (_initialize_ser_dos): Add declaration. * ser-mingw.c (_initialize_ser_windows): Add declaration. * ser-pipe.c (_initialize_ser_pipe): Add declaration. * ser-tcp.c (_initialize_ser_tcp): Add declaration. * ser-uds.c (_initialize_ser_socket): Add declaration. * ser-unix.c (_initialize_ser_hardwire): Add declaration. * serial.c (_initialize_serial): Add declaration. * sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration. * sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration. * sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration. * sh-tdep.c (_initialize_sh_tdep): Add declaration. * skip.c (_initialize_step_skip): Add declaration. * sol-thread.c (_initialize_sol_thread): Add declaration. * solib-aix.c (_initialize_solib_aix): Add declaration. * solib-darwin.c (_initialize_darwin_solib): Add declaration. * solib-dsbt.c (_initialize_dsbt_solib): Add declaration. * solib-frv.c (_initialize_frv_solib): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib-target.c (_initialize_solib_target): Add declaration. * solib.c (_initialize_solib): Add declaration. * source-cache.c (_initialize_source_cache): Add declaration. * source.c (_initialize_source): Add declaration. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration. * sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration. * sparc-nat.c (_initialize_sparc_nat): Add declaration. * sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration. * sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration. * sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration. * sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration. * sparc-tdep.c (_initialize_sparc_tdep): Add declaration. * sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration. * sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration. * sparc64-nat.c (_initialize_sparc64_nat): Add declaration. * sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration. * sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration. * sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration. * sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration. * stabsread.c (_initialize_stabsread): Add declaration. * stack.c (_initialize_stack): Add declaration. * stap-probe.c (_initialize_stap_probe): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * symfile-debug.c (_initialize_symfile_debug): Add declaration. * symfile-mem.c (_initialize_symfile_mem): Add declaration. * symfile.c (_initialize_symfile): Add declaration. * symmisc.c (_initialize_symmisc): Add declaration. * symtab.c (_initialize_symtab): Add declaration. * target.c (_initialize_target): Add declaration. * target-connection.c (_initialize_target_connection): Add declaration. * target-dcache.c (_initialize_target_dcache): Add declaration. * target-descriptions.c (_initialize_target_descriptions): Add declaration. * thread.c (_initialize_thread): Add declaration. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration. * tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration. * tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration. * tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration. * tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration. * tracectf.c (_initialize_ctf): Add declaration. * tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration. * tracefile.c (_initialize_tracefile): Add declaration. * tracepoint.c (_initialize_tracepoint): Add declaration. * tui/tui-hooks.c (_initialize_tui_hooks): Add declaration. * tui/tui-interp.c (_initialize_tui_interp): Add declaration. * tui/tui-layout.c (_initialize_tui_layout): Add declaration. * tui/tui-regs.c (_initialize_tui_regs): Add declaration. * tui/tui-stack.c (_initialize_tui_stack): Add declaration. * tui/tui-win.c (_initialize_tui_win): Add declaration. * tui/tui.c (_initialize_tui): Add declaration. * typeprint.c (_initialize_typeprint): Add declaration. * ui-style.c (_initialize_ui_style): Add declaration. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration. * unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration. * unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration. * unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration. * unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration. * unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration. * unittests/filtered_iterator-selftests.c (_initialize_filtered_iterator_selftests): Add declaration. * unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration. * unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration. * unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration. * unittests/main-thread-selftests.c (_initialize_main_thread_selftests): Add declaration. * unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration. * unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration. * unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration. * unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration. * unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration. * unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration. * unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration. * unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration. * unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration. * unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration. * unittests/style-selftests.c (_initialize_style_selftest): Add declaration. * unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration. * unittests/tui-selftests.c (_initialize_tui_selftest): Add declaration. * unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration. * unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration. * unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration. * unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration. * user-regs.c (_initialize_user_regs): Add declaration. * utils.c (_initialize_utils): Add declaration. * v850-tdep.c (_initialize_v850_tdep): Add declaration. * valops.c (_initialize_valops): Add declaration. * valprint.c (_initialize_valprint): Add declaration. * value.c (_initialize_values): Add declaration. * varobj.c (_initialize_varobj): Add declaration. * vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * windows-nat.c (_initialize_windows_nat): Add declaration. (_initialize_check_for_gdb_ini): Add declaration. (_initialize_loadable): Add declaration. * windows-tdep.c (_initialize_windows_tdep): Add declaration. * x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration. * x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration. * xcoffread.c (_initialize_xcoffread): Add declaration. * xml-support.c (_initialize_xml_support): Add declaration. * xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration. * xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration. * xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration. Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 20:01:38 +01:00
void _initialize_arm_tdep ();
void
gdb: add back declarations for _initialize functions I'd like to enable the -Wmissing-declarations warning. However, it warns for every _initialize function, for example: CXX dcache.o /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’: /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations] _initialize_dcache (void) ^~~~~~~~~~~~~~~~~~ The only practical way forward I found is to add back the declarations, which were removed by this commit: commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9 Author: John Baldwin <jhb@FreeBSD.org> Date: Sat Sep 9 11:02:37 2017 -0700 Remove unnecessary function prototypes. I don't think it's a big problem to have the declarations for these functions, but if anybody has a better solution for this, I'll be happy to use it. gdb/ChangeLog: * aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration. * aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration. * aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration. * aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration. * aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration. * aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration. * ada-exp.y (_initialize_ada_exp): Add declaration. * ada-lang.c (_initialize_ada_language): Add declaration. * ada-tasks.c (_initialize_tasks): Add declaration. * agent.c (_initialize_agent): Add declaration. * aix-thread.c (_initialize_aix_thread): Add declaration. * alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration. * alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. * amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration. * amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration. * amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration. * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration. * amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration. * amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration. * amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration. * amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration. * amd64-tdep.c (_initialize_amd64_tdep): Add declaration. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration. * amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration. * annotate.c (_initialize_annotate): Add declaration. * arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration. * arc-tdep.c (_initialize_arc_tdep): Add declaration. * arch-utils.c (_initialize_gdbarch_utils): Add declaration. * arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration. * arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration. * arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration. * arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration. * arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration. * arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration. * arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration. * arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration. * auto-load.c (_initialize_auto_load): Add declaration. * auxv.c (_initialize_auxv): Add declaration. * avr-tdep.c (_initialize_avr_tdep): Add declaration. * ax-gdb.c (_initialize_ax_gdb): Add declaration. * bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration. * bfin-tdep.c (_initialize_bfin_tdep): Add declaration. * break-catch-sig.c (_initialize_break_catch_sig): Add declaration. * break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration. * break-catch-throw.c (_initialize_break_catch_throw): Add declaration. * breakpoint.c (_initialize_breakpoint): Add declaration. * bsd-uthread.c (_initialize_bsd_uthread): Add declaration. * btrace.c (_initialize_btrace): Add declaration. * charset.c (_initialize_charset): Add declaration. * cli/cli-cmds.c (_initialize_cli_cmds): Add declaration. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-logging.c (_initialize_cli_logging): Add declaration. * cli/cli-script.c (_initialize_cli_script): Add declaration. * cli/cli-style.c (_initialize_cli_style): Add declaration. * coff-pe-read.c (_initialize_coff_pe_read): Add declaration. * coffread.c (_initialize_coffread): Add declaration. * compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration. * compile/compile.c (_initialize_compile): Add declaration. * complaints.c (_initialize_complaints): Add declaration. * completer.c (_initialize_completer): Add declaration. * copying.c (_initialize_copying): Add declaration. * corefile.c (_initialize_core): Add declaration. * corelow.c (_initialize_corelow): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * cp-namespace.c (_initialize_cp_namespace): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-valprint.c (_initialize_cp_valprint): Add declaration. * cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration. * cris-tdep.c (_initialize_cris_tdep): Add declaration. * csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration. * csky-tdep.c (_initialize_csky_tdep): Add declaration. * ctfread.c (_initialize_ctfread): Add declaration. * d-lang.c (_initialize_d_language): Add declaration. * darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration. * darwin-nat.c (_initialize_darwin_nat): Add declaration. * dbxread.c (_initialize_dbxread): Add declaration. * dcache.c (_initialize_dcache): Add declaration. * disasm-selftests.c (_initialize_disasm_selftests): Add declaration. * disasm.c (_initialize_disasm): Add declaration. * dtrace-probe.c (_initialize_dtrace_probe): Add declaration. * dummy-frame.c (_initialize_dummy_frame): Add declaration. * dwarf-index-cache.c (_initialize_index_cache): Add declaration. * dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration. * dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration. * dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration. * dwarf2expr.c (_initialize_dwarf2expr): Add declaration. * dwarf2loc.c (_initialize_dwarf2loc): Add declaration. * dwarf2read.c (_initialize_dwarf2_read): Add declaration. * elfread.c (_initialize_elfread): Add declaration. * exec.c (_initialize_exec): Add declaration. * extension.c (_initialize_extension): Add declaration. * f-lang.c (_initialize_f_language): Add declaration. * f-valprint.c (_initialize_f_valprint): Add declaration. * fbsd-nat.c (_initialize_fbsd_nat): Add declaration. * fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration. * filesystem.c (_initialize_filesystem): Add declaration. * findcmd.c (_initialize_mem_search): Add declaration. * findvar.c (_initialize_findvar): Add declaration. * fork-child.c (_initialize_fork_child): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (_initialize_frame): Add declaration. * frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration. * frv-tdep.c (_initialize_frv_tdep): Add declaration. * ft32-tdep.c (_initialize_ft32_tdep): Add declaration. * gcore.c (_initialize_gcore): Add declaration. * gdb-demangle.c (_initialize_gdb_demangle): Add declaration. * gdb_bfd.c (_initialize_gdb_bfd): Add declaration. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration. * gdbarch.c (_initialize_gdbarch): Add declaration. * gdbtypes.c (_initialize_gdbtypes): Add declaration. * gnu-nat.c (_initialize_gnu_nat): Add declaration. * gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration. * gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration. * go-lang.c (_initialize_go_language): Add declaration. * go32-nat.c (_initialize_go32_nat): Add declaration. * guile/guile.c (_initialize_guile): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration. * hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration. * hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration. * hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration. * hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration. * hppa-tdep.c (_initialize_hppa_tdep): Add declaration. * i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration. * i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration. * i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration. * i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration. * i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration. * i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration. * i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration. * i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration. * i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration. * i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration. * i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration. * i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration. * i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration. * i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration. * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration. * i386-tdep.c (_initialize_i386_tdep): Add declaration. * i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration. * ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration. * ia64-tdep.c (_initialize_ia64_tdep): Add declaration. * ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration. * infcall.c (_initialize_infcall): Add declaration. * infcmd.c (_initialize_infcmd): Add declaration. * inflow.c (_initialize_inflow): Add declaration. * infrun.c (_initialize_infrun): Add declaration. * interps.c (_initialize_interpreter): Add declaration. * iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration. * jit.c (_initialize_jit): Add declaration. * language.c (_initialize_language): Add declaration. * linux-fork.c (_initialize_linux_fork): Add declaration. * linux-nat.c (_initialize_linux_nat): Add declaration. * linux-tdep.c (_initialize_linux_tdep): Add declaration. * linux-thread-db.c (_initialize_thread_db): Add declaration. * lm32-tdep.c (_initialize_lm32_tdep): Add declaration. * m2-lang.c (_initialize_m2_language): Add declaration. * m32c-tdep.c (_initialize_m32c_tdep): Add declaration. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration. * m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration. * m32r-tdep.c (_initialize_m32r_tdep): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. * m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration. * m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration. * m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration. * m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * machoread.c (_initialize_machoread): Add declaration. * macrocmd.c (_initialize_macrocmd): Add declaration. * macroscope.c (_initialize_macroscope): Add declaration. * maint-test-options.c (_initialize_maint_test_options): Add declaration. * maint-test-settings.c (_initialize_maint_test_settings): Add declaration. * maint.c (_initialize_maint_cmds): Add declaration. * mdebugread.c (_initialize_mdebugread): Add declaration. * memattr.c (_initialize_mem): Add declaration. * mep-tdep.c (_initialize_mep_tdep): Add declaration. * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration. * mi/mi-cmds.c (_initialize_mi_cmds): Add declaration. * mi/mi-interp.c (_initialize_mi_interp): Add declaration. * mi/mi-main.c (_initialize_mi_main): Add declaration. * microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration. * microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration. * mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration. * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration. * mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration. * mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration. * mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration. * mipsread.c (_initialize_mipsread): Add declaration. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration. * mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration. * moxie-tdep.c (_initialize_moxie_tdep): Add declaration. * msp430-tdep.c (_initialize_msp430_tdep): Add declaration. * nds32-tdep.c (_initialize_nds32_tdep): Add declaration. * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration. * nios2-tdep.c (_initialize_nios2_tdep): Add declaration. * nto-procfs.c (_initialize_procfs): Add declaration. * objc-lang.c (_initialize_objc_language): Add declaration. * observable.c (_initialize_observer): Add declaration. * opencl-lang.c (_initialize_opencl_language): Add declaration. * or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration. * or1k-tdep.c (_initialize_or1k_tdep): Add declaration. * osabi.c (_initialize_gdb_osabi): Add declaration. * osdata.c (_initialize_osdata): Add declaration. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * parse.c (_initialize_parse): Add declaration. * ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration. * ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration. * ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration. * ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration. * printcmd.c (_initialize_printcmd): Add declaration. * probe.c (_initialize_probe): Add declaration. * proc-api.c (_initialize_proc_api): Add declaration. * proc-events.c (_initialize_proc_events): Add declaration. * proc-service.c (_initialize_proc_service): Add declaration. * procfs.c (_initialize_procfs): Add declaration. * producer.c (_initialize_producer): Add declaration. * psymtab.c (_initialize_psymtab): Add declaration. * python/python.c (_initialize_python): Add declaration. * ravenscar-thread.c (_initialize_ravenscar): Add declaration. * record-btrace.c (_initialize_record_btrace): Add declaration. * record-full.c (_initialize_record_full): Add declaration. * record.c (_initialize_record): Add declaration. * regcache-dump.c (_initialize_regcache_dump): Add declaration. * regcache.c (_initialize_regcache): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * remote-notif.c (_initialize_notif): Add declaration. * remote-sim.c (_initialize_remote_sim): Add declaration. * remote.c (_initialize_remote): Add declaration. * reverse.c (_initialize_reverse): Add declaration. * riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration. * riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration. * riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration. * riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration. * riscv-tdep.c (_initialize_riscv_tdep): Add declaration. * rl78-tdep.c (_initialize_rl78_tdep): Add declaration. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration. * rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep): Add declaration. * rs6000-nat.c (_initialize_rs6000_nat): Add declaration. * rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration. * run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration. * rust-exp.y (_initialize_rust_exp): Add declaration. * rx-tdep.c (_initialize_rx_tdep): Add declaration. * s12z-tdep.c (_initialize_s12z_tdep): Add declaration. * s390-linux-nat.c (_initialize_s390_nat): Add declaration. * s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration. * s390-tdep.c (_initialize_s390_tdep): Add declaration. * score-tdep.c (_initialize_score_tdep): Add declaration. * ser-go32.c (_initialize_ser_dos): Add declaration. * ser-mingw.c (_initialize_ser_windows): Add declaration. * ser-pipe.c (_initialize_ser_pipe): Add declaration. * ser-tcp.c (_initialize_ser_tcp): Add declaration. * ser-uds.c (_initialize_ser_socket): Add declaration. * ser-unix.c (_initialize_ser_hardwire): Add declaration. * serial.c (_initialize_serial): Add declaration. * sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration. * sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration. * sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration. * sh-tdep.c (_initialize_sh_tdep): Add declaration. * skip.c (_initialize_step_skip): Add declaration. * sol-thread.c (_initialize_sol_thread): Add declaration. * solib-aix.c (_initialize_solib_aix): Add declaration. * solib-darwin.c (_initialize_darwin_solib): Add declaration. * solib-dsbt.c (_initialize_dsbt_solib): Add declaration. * solib-frv.c (_initialize_frv_solib): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib-target.c (_initialize_solib_target): Add declaration. * solib.c (_initialize_solib): Add declaration. * source-cache.c (_initialize_source_cache): Add declaration. * source.c (_initialize_source): Add declaration. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration. * sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration. * sparc-nat.c (_initialize_sparc_nat): Add declaration. * sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration. * sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration. * sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration. * sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration. * sparc-tdep.c (_initialize_sparc_tdep): Add declaration. * sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration. * sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration. * sparc64-nat.c (_initialize_sparc64_nat): Add declaration. * sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration. * sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration. * sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration. * sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration. * stabsread.c (_initialize_stabsread): Add declaration. * stack.c (_initialize_stack): Add declaration. * stap-probe.c (_initialize_stap_probe): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * symfile-debug.c (_initialize_symfile_debug): Add declaration. * symfile-mem.c (_initialize_symfile_mem): Add declaration. * symfile.c (_initialize_symfile): Add declaration. * symmisc.c (_initialize_symmisc): Add declaration. * symtab.c (_initialize_symtab): Add declaration. * target.c (_initialize_target): Add declaration. * target-connection.c (_initialize_target_connection): Add declaration. * target-dcache.c (_initialize_target_dcache): Add declaration. * target-descriptions.c (_initialize_target_descriptions): Add declaration. * thread.c (_initialize_thread): Add declaration. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration. * tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration. * tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration. * tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration. * tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration. * tracectf.c (_initialize_ctf): Add declaration. * tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration. * tracefile.c (_initialize_tracefile): Add declaration. * tracepoint.c (_initialize_tracepoint): Add declaration. * tui/tui-hooks.c (_initialize_tui_hooks): Add declaration. * tui/tui-interp.c (_initialize_tui_interp): Add declaration. * tui/tui-layout.c (_initialize_tui_layout): Add declaration. * tui/tui-regs.c (_initialize_tui_regs): Add declaration. * tui/tui-stack.c (_initialize_tui_stack): Add declaration. * tui/tui-win.c (_initialize_tui_win): Add declaration. * tui/tui.c (_initialize_tui): Add declaration. * typeprint.c (_initialize_typeprint): Add declaration. * ui-style.c (_initialize_ui_style): Add declaration. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration. * unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration. * unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration. * unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration. * unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration. * unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration. * unittests/filtered_iterator-selftests.c (_initialize_filtered_iterator_selftests): Add declaration. * unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration. * unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration. * unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration. * unittests/main-thread-selftests.c (_initialize_main_thread_selftests): Add declaration. * unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration. * unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration. * unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration. * unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration. * unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration. * unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration. * unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration. * unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration. * unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration. * unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration. * unittests/style-selftests.c (_initialize_style_selftest): Add declaration. * unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration. * unittests/tui-selftests.c (_initialize_tui_selftest): Add declaration. * unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration. * unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration. * unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration. * unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration. * user-regs.c (_initialize_user_regs): Add declaration. * utils.c (_initialize_utils): Add declaration. * v850-tdep.c (_initialize_v850_tdep): Add declaration. * valops.c (_initialize_valops): Add declaration. * valprint.c (_initialize_valprint): Add declaration. * value.c (_initialize_values): Add declaration. * varobj.c (_initialize_varobj): Add declaration. * vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * windows-nat.c (_initialize_windows_nat): Add declaration. (_initialize_check_for_gdb_ini): Add declaration. (_initialize_loadable): Add declaration. * windows-tdep.c (_initialize_windows_tdep): Add declaration. * x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration. * x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration. * xcoffread.c (_initialize_xcoffread): Add declaration. * xml-support.c (_initialize_xml_support): Add declaration. * xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration. * xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration. * xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration. Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 20:01:38 +01:00
_initialize_arm_tdep ()
{
long length;
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
int i, j;
char regdesc[1024], *rdptr = regdesc;
size_t rest = sizeof (regdesc);
1999-06-28 18:06:02 +02:00
gdbarch_register (bfd_arch_arm, arm_gdbarch_init, arm_dump_tdep);
/* Add ourselves to objfile event chain. */
Convert observers to C++ This converts observers from using a special source-generating script to be plain C++. This version of the patch takes advantage of C++11 by using std::function and variadic templates; incorporates Pedro's patches; and renames the header file to "observable.h" (this change eliminates the need for a clean rebuild). Note that Pedro's patches used a template lambda in tui-hooks.c, but this failed to compile on some buildbot instances (presumably due to differing C++ versions); I replaced this with an ordinary template function. Regression tested on the buildbot. gdb/ChangeLog 2018-03-19 Pedro Alves <palves@redhat.com> Tom Tromey <tom@tromey.com> * unittests/observable-selftests.c: New file. * common/observable.h: New file. * observable.h: New file. * ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c, arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c, breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c, corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c, extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c, infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c, linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c, mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c, ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c, python/py-breakpoint.c, python/py-finishbreakpoint.c, python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c, record-btrace.c, record-full.c, record.c, regcache.c, remote.c, riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c, spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c, symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c, tui/tui-interp.c, valops.c: Update all users. * tui/tui-hooks.c (tui_bp_created_observer) (tui_bp_deleted_observer, tui_bp_modified_observer) (tui_inferior_exit_observer, tui_before_prompt_observer) (tui_normal_stop_observer, tui_register_changed_observer): Remove. (tui_observers_token): New global. (attach_or_detach, tui_attach_detach_observers): New functions. (tui_install_hooks, tui_remove_hooks): Use tui_attach_detach_observers. * record-btrace.c (record_btrace_thread_observer): Remove. (record_btrace_thread_observer_token): New global. * observer.sh: Remove. * observer.c: Rename to observable.c. * observable.c (namespace gdb_observers): Define new objects. (observer_debug): Move into gdb_observers namespace. (struct observer, struct observer_list, xalloc_observer_list_node) (xfree_observer_list_node, generic_observer_attach) (generic_observer_detach, generic_observer_notify): Remove. (_initialize_observer): Update. Don't include observer.inc. * Makefile.in (generated_files): Remove observer.h, observer.inc. (clean mostlyclean): Likewise. (observer.h, observer.inc): Remove targets. (SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c. (COMMON_SFILES): Use observable.c, not observer.c. * .gitignore: Remove observer.h. gdb/doc/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * observer.texi: Remove. gdb/testsuite/ChangeLog 2018-03-19 Tom Tromey <tom@tromey.com> * gdb.gdb/observer.exp: Remove.
2016-10-02 18:50:20 +02:00
gdb::observers::new_objfile.attach (arm_exidx_new_objfile);
* Makefile.in (SFILES): Add osabi.c. (COMMON_OBS): Add osabi.o. (osabi.o): New dependency list. * osabi.c: New file. * osabi.h: New file. * doc/gdbint.texinfo: Document new generic OS ABI framework. * Makefile.in (alpha_tdep_h): Define and use instead of alpha-tdep.h. * alpha-tdep.c (alpha_abi_names, process_note_abi_tag_sections, get_elfosabi, alpha_abi_handler_list, alpha_gdbarch_register_os_abi): Remove. (alpha_gdbarch_init, alpha_dump_tdep): Use generic OS ABI framework. * alpha-tdep.h: Include osabi.h. (alpha_abi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Use gdbarch_register_osabi. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise. * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise. * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise. * Makefile.in (sh_tdep_h): Add osabi.h. * sh-tdep.h (sh_osabi): Remove. (gdbarch_tdep): Use generic OS ABI framework. * sh-tdep.c (sh_osabi_names, process_note_abi_tag_sections, sh_osabi_handler_list, sh_gdbarch_register_os_abi): Remove. (sh_gdbarch_init, sh_dump_tdep): Use generic OS ABI framework. * shnbsd-tdep.c (_initialize_shnbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (arm_tdep_h): Define and use instead of arm-tdep.h. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Use gdbarch_register_osabi. * arm-tdep.c (arm_abi_names, process_note_abi_tag_sections, arm_abi_handler_list, arm_gdbarch_register_os_abi): Remove. (get_elfosabi): Rename to... (arm_elf_osabi_sniffer): ...this. Adjust to use generic OS ABI framework support routines. (arm_gdbarch_init): Use generic OS ABI framework. (arm_dump_tdep): Likewise. (_initialize_arm_tdep): Likewise. * arm-tdep.h: Include osabi.h. (arm_abi): Remove. (gdbarch_tdep): Remove arm_abi and abi_name members. Add osabi member. (arm_gdbarch_register_os_abi): Remove prototype. * armnbsd-tdep.c (arm_netbsd_aout_osabi_sniffer): New function. (_initialize_arm_netbsd_tdep): Use gdbarch_register_osabi. * Makefile.in (mips-tdep.o): Add osabi.h to dependency list. * mips-tdep.c: Include osabi.h. (gdbarch_tdep, mips_gdbarch_init, mips_dump_tdep): Use generic OS ABI framework.
2002-05-21 17:36:03 +02:00
/* Register an ELF OS ABI sniffer for ARM binaries. */
gdbarch_register_osabi_sniffer (bfd_arch_arm,
bfd_target_elf_flavour,
arm_elf_osabi_sniffer);
/* Add root prefix command for all "set arm"/"show arm" commands. */
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_basic_prefix_cmd ("arm", no_class,
_("Various ARM-specific commands."),
&setarmcmdlist, "set arm ", 0, &setlist);
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_show_prefix_cmd ("arm", no_class,
_("Various ARM-specific commands."),
&showarmcmdlist, "show arm ", 0, &showlist);
1999-07-07 22:19:36 +02:00
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
arm_disassembler_options = xstrdup ("reg-names-std");
GDB PR tdep/8282: MIPS: Wire in `set disassembler-options' Implement MIPS target support for passing options to the disassembler, complementing commit 65b48a81404c ("GDB: Add support for the new set/show disassembler-options commands."). This includes options that expect an argument, so adjust the generic code and data structures used so as to handle such options. So as to give backends syntax flexibility no specific delimiter has been defined to separate options from their respective arguments, so it has to be included as the last character of the option name. Completion code however has not been adjusted and consequently option arguments cannot be completed at this time. Also the MIPS target has non-empty defaults for the options, so that ABI names for the general-purpose registers respect our `set mips abi ...' setting rather than always being determined from the ELF headers of the binary file selected. Handle these defaults as implicit options, never shown to the user and always prepended to the user-specified options, so that the latters can override the defaults. The resulting output for the MIPS target is as follows: (gdb) show disassembler-options The current disassembler options are '' The following disassembler options are supported for use with the 'set disassembler-options <option>[,<option>...]' command: no-aliases Use canonical instruction forms. msa Recognize MSA instructions. virt Recognize the virtualization ASE instructions. xpa Recognize the eXtended Physical Address (XPA) ASE instructions. ginv Recognize the Global INValidate (GINV) ASE instructions. gpr-names=ABI Print GPR names according to specified ABI. Default: based on binary being disassembled. fpr-names=ABI Print FPR names according to specified ABI. Default: numeric. cp0-names=ARCH Print CP0 register names according to specified architecture. Default: based on binary being disassembled. hwr-names=ARCH Print HWR names according to specified architecture. Default: based on binary being disassembled. reg-names=ABI Print GPR and FPR names according to specified ABI. reg-names=ARCH Print CP0 register and HWR names according to specified architecture. For the options above, the following values are supported for "ABI": numeric 32 n32 64 For the options above, the following values are supported for "ARCH": numeric r3000 r3900 r4000 r4010 vr4100 vr4111 vr4120 r4300 r4400 r4600 r4650 r5000 vr5400 vr5500 r5900 r6000 rm7000 rm9000 r8000 r10000 r12000 r14000 r16000 mips5 mips32 mips32r2 mips32r3 mips32r5 mips32r6 mips64 mips64r2 mips64r3 mips64r5 mips64r6 interaptiv-mr2 sb1 loongson2e loongson2f loongson3a octeon octeon+ octeon2 octeon3 xlr xlp (gdb) which corresponds to what `objdump --help' used to print for the MIPS target, with minor formatting changes, most notably option argument lists being wrapped, but also the amount of white space separating options from the respective descriptions. The relevant part the new code is now also used by `objdump --help', which means these formatting changes apply to both outputs, except for argument list wrapping, which is GDB-specific. This also adds a separating new line between the heading and option lists where descriptions are provided, hence: (gdb) set architecture s390:31-bit (gdb) show disassembler-options The current disassembler options are '' The following disassembler options are supported for use with the 'set disassembler-options <option>[,<option>...]' command: esa Disassemble in ESA architecture mode zarch Disassemble in z/Architecture mode insnlength Print unknown instructions according to length from first two bits (gdb) but: (gdb) set architecture powerpc:common (gdb) show disassembler-options The current disassembler options are '' The following disassembler options are supported for use with the 'set disassembler-options <option>[,<option>...]' command: 403, 405, 440, 464, 476, 601, 603, 604, 620, 7400, 7410, 7450, 7455, 750cl, 821, 850, 860, a2, altivec, any, booke, booke32, cell, com, e200z4, e300, e500, e500mc, e500mc64, e5500, e6500, e500x2, efs, efs2, power4, power5, power6, power7, power8, power9, ppc, ppc32, 32, ppc64, 64, ppc64bridge, ppcps, pwr, pwr2, pwr4, pwr5, pwr5x, pwr6, pwr7, pwr8, pwr9, pwrx, raw, spe, spe2, titan, vle, vsx (gdb) Existing affected target backends have been adjusted accordingly. This has been verified manually with: (gdb) set architecture arm (gdb) set architecture powerpc:common (gdb) set architecture s390:31-bit to cause no issues with the `show disassembler-options' and `set disassembler-options' commands. A test case for the MIPS target has also been provided, covering the default settings with ABI overrides as well as disassembler option overrides. 2018-07-02 Maciej W. Rozycki <macro@mips.com> Simon Marchi <simon.marchi@polymtl.ca> include/ PR tdep/8282 * dis-asm.h (disasm_option_arg_t): New typedef. (disasm_options_and_args_t): Likewise. (disasm_options_t): Add `arg' member, document members. (disassembler_options_mips): New prototype. (disassembler_options_arm, disassembler_options_powerpc) (disassembler_options_s390): Update prototypes. opcodes/ PR tdep/8282 * mips-dis.c (mips_option_arg_t): New enumeration. (mips_options): New variable. (disassembler_options_mips): New function. (print_mips_disassembler_options): Reimplement in terms of `disassembler_options_mips'. * arm-dis.c (disassembler_options_arm): Adapt to using the `disasm_options_and_args_t' structure. * ppc-dis.c (disassembler_options_powerpc): Likewise. * s390-dis.c (disassembler_options_s390): Likewise. gdb/ PR tdep/8282 * disasm.h (gdb_disassembler): Add `m_disassembler_options_holder'. member * disasm.c (get_all_disassembler_options): New function. (gdb_disassembler::gdb_disassembler): Use it. (gdb_buffered_insn_length_init_dis): Likewise. (gdb_buffered_insn_length): Adjust accordingly. (set_disassembler_options): Handle options with arguments. (show_disassembler_options_sfunc): Likewise. Add a leading new line if showing options with descriptions. (disassembler_options_completer): Adapt to using the `disasm_options_and_args_t' structure. * mips-tdep.c (mips_disassembler_options): New variable. (mips_disassembler_options_o32): Likewise. (mips_disassembler_options_n32): Likewise. (mips_disassembler_options_n64): Likewise. (gdb_print_insn_mips): Don't set `disassembler_options'. (gdb_print_insn_mips_n32, gdb_print_insn_mips_n64): Remove functions. (mips_gdbarch_init): Always set `gdbarch_print_insn' to `gdb_print_insn_mips'. Set `gdbarch_disassembler_options', `gdbarch_disassembler_options_implicit' and `gdbarch_valid_disassembler_options'. * arm-tdep.c (_initialize_arm_tdep): Adapt to using the `disasm_options_and_args_t' structure. * gdbarch.sh (disassembler_options_implicit): New `gdbarch' method. (valid_disassembler_options): Switch from `disasm_options_t' to the `disasm_options_and_args_t' structure. * NEWS: Document `set disassembler-options' support for the MIPS target. * gdbarch.h: Regenerate. * gdbarch.c: Regenerate. gdb/doc/ PR tdep/8282 * gdb.texinfo (Source and Machine Code): Document `set disassembler-options' support for the MIPS target. gdb/testsuite/ PR tdep/8282 * gdb.arch/mips-disassembler-options.exp: New test. * gdb.arch/mips-disassembler-options.s: New test source.
2018-07-03 00:57:21 +02:00
const disasm_options_t *disasm_options
= &disassembler_options_arm ()->options;
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
int num_disassembly_styles = 0;
for (i = 0; disasm_options->name[i] != NULL; i++)
if (CONST_STRNEQ (disasm_options->name[i], "reg-names-"))
num_disassembly_styles++;
/* Initialize the array that will be passed to add_setshow_enum_cmd(). */
Replace some xmalloc-family functions with XNEW-family ones This patch is part of the make-gdb-buildable-in-C++ effort. The idea is to change some calls to the xmalloc family of functions to calls to the equivalents in the XNEW family. This avoids adding an explicit cast, so it keeps the code a bit more readable. Some of them also map relatively well to a C++ equivalent (XNEW (struct foo) -> new foo), so it will be possible to do scripted replacements if needed. I only changed calls that were obviously allocating memory for one or multiple "objects". Allocation of variable sizes (such as strings or buffer handling) will be for later (and won't use XNEW). - xmalloc (sizeof (struct foo)) -> XNEW (struct foo) - xmalloc (num * sizeof (struct foo)) -> XNEWVEC (struct foo, num) - xcalloc (1, sizeof (struct foo)) -> XCNEW (struct foo) - xcalloc (num, sizeof (struct foo)) -> XCNEWVEC (struct foo, num) - xrealloc (p, num * sizeof (struct foo) -> XRESIZEVEC (struct foo, p, num) - obstack_alloc (ob, sizeof (struct foo)) -> XOBNEW (ob, struct foo) - obstack_alloc (ob, num * sizeof (struct foo)) -> XOBNEWVEC (ob, struct foo, num) - alloca (sizeof (struct foo)) -> XALLOCA (struct foo) - alloca (num * sizeof (struct foo)) -> XALLOCAVEC (struct foo, num) Some instances of xmalloc followed by memset to zero the buffer were replaced by XCNEW or XCNEWVEC. I regtested on x86-64, Ubuntu 14.04, but the patch touches many architecture-specific files. For those I'll have to rely on the buildbot or people complaining that I broke their gdb. gdb/ChangeLog: * aarch64-linux-nat.c (aarch64_add_process): Likewise. * aarch64-tdep.c (aarch64_gdbarch_init): Likewise. * ada-exp.y (write_ambiguous_var): Likewise. * ada-lang.c (resolve_subexp): Likewise. (user_select_syms): Likewise. (assign_aggregate): Likewise. (ada_evaluate_subexp): Likewise. (cache_symbol): Likewise. * addrmap.c (allocate_key): Likewise. (addrmap_create_mutable): Likewise. * aix-thread.c (sync_threadlists): Likewise. * alpha-tdep.c (alpha_push_dummy_call): Likewise. (alpha_gdbarch_init): Likewise. * amd64-windows-tdep.c (amd64_windows_push_arguments): Likewise. * arm-linux-nat.c (arm_linux_add_process): Likewise. * arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise. * arm-tdep.c (push_stack_item): Likewise. (arm_displaced_step_copy_insn): Likewise. (arm_gdbarch_init): Likewise. (_initialize_arm_tdep): Likewise. * avr-tdep.c (push_stack_item): Likewise. * ax-general.c (new_agent_expr): Likewise. * block.c (block_initialize_namespace): Likewise. * breakpoint.c (alloc_counted_command_line): Likewise. (update_dprintf_command_list): Likewise. (parse_breakpoint_sals): Likewise. (decode_static_tracepoint_spec): Likewise. (until_break_command): Likewise. (clear_command): Likewise. (update_global_location_list): Likewise. (get_breakpoint_objfile_data) Likewise. * btrace.c (ftrace_new_function): Likewise. (btrace_set_insn_history): Likewise. (btrace_set_call_history): Likewise. * buildsym.c (add_symbol_to_list): Likewise. (record_pending_block): Likewise. (start_subfile): Likewise. (start_buildsym_compunit): Likewise. (push_subfile): Likewise. (end_symtab_get_static_block): Likewise. (buildsym_init): Likewise. * cli/cli-cmds.c (source_command): Likewise. * cli/cli-decode.c (add_cmd): Likewise. * cli/cli-script.c (build_command_line): Likewise. (setup_user_args): Likewise. (realloc_body_list): Likewise. (process_next_line): Likewise. (copy_command_lines): Likewise. * cli/cli-setshow.c (do_set_command): Likewise. * coff-pe-read.c (read_pe_exported_syms): Likewise. * coffread.c (coff_locate_sections): Likewise. (coff_symtab_read): Likewise. (coff_read_struct_type): Likewise. * common/cleanups.c (make_my_cleanup2): Likewise. * common/common-exceptions.c (throw_it): Likewise. * common/filestuff.c (make_cleanup_close): Likewise. * common/format.c (parse_format_string): Likewise. * common/queue.h (DEFINE_QUEUE_P): Likewise. * compile/compile-object-load.c (munmap_list_add): Likewise. (compile_object_load): Likewise. * compile/compile-object-run.c (compile_object_run): Likewise. * compile/compile.c (append_args): Likewise. * corefile.c (specify_exec_file_hook): Likewise. * cp-support.c (make_symbol_overload_list): Likewise. * cris-tdep.c (push_stack_item): Likewise. (cris_gdbarch_init): Likewise. * ctf.c (ctf_trace_file_writer_new): Likewise. * dbxread.c (init_header_files): Likewise. (add_new_header_file): Likewise. (init_bincl_list): Likewise. (dbx_end_psymtab): Likewise. (start_psymtab): Likewise. (dbx_end_psymtab): Likewise. * dcache.c (dcache_init): Likewise. * dictionary.c (dict_create_hashed): Likewise. (dict_create_hashed_expandable): Likewise. (dict_create_linear): Likewise. (dict_create_linear_expandable): Likewise. * dtrace-probe.c (dtrace_process_dof_probe): Likewise. * dummy-frame.c (register_dummy_frame_dtor): Likewise. * dwarf2-frame-tailcall.c (cache_new_ref1): Likewise. * dwarf2-frame.c (dwarf2_build_frame_info): Likewise. (decode_frame_entry_1): Likewise. * dwarf2expr.c (new_dwarf_expr_context): Likewise. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Likewise. * dwarf2read.c (dwarf2_has_info): Likewise. (create_signatured_type_table_from_index): Likewise. (dwarf2_read_index): Likewise. (dw2_get_file_names_reader): Likewise. (create_all_type_units): Likewise. (read_cutu_die_from_dwo): Likewise. (init_tu_and_read_dwo_dies): Likewise. (init_cutu_and_read_dies): Likewise. (create_all_comp_units): Likewise. (queue_comp_unit): Likewise. (inherit_abstract_dies): Likewise. (read_call_site_scope): Likewise. (dwarf2_add_field): Likewise. (dwarf2_add_typedef): Likewise. (dwarf2_add_member_fn): Likewise. (attr_to_dynamic_prop): Likewise. (abbrev_table_alloc_abbrev): Likewise. (abbrev_table_read_table): Likewise. (add_include_dir): Likewise. (add_file_name): Likewise. (dwarf_decode_line_header): Likewise. (dwarf2_const_value_attr): Likewise. (dwarf_alloc_block): Likewise. (parse_macro_definition): Likewise. (set_die_type): Likewise. (write_psymtabs_to_index): Likewise. (create_cus_from_index): Likewise. (dwarf2_create_include_psymtab): Likewise. (process_psymtab_comp_unit_reader): Likewise. (build_type_psymtab_dependencies): Likewise. (read_comp_units_from_section): Likewise. (compute_compunit_symtab_includes): Likewise. (create_dwo_unit_in_dwp_v1): Likewise. (create_dwo_unit_in_dwp_v2): Likewise. (read_func_scope): Likewise. (process_structure_scope): Likewise. (mark_common_block_symbol_computed): Likewise. (load_partial_dies): Likewise. (dwarf2_symbol_mark_computed): Likewise. * elfread.c (elf_symfile_segments): Likewise. (elf_read_minimal_symbols): Likewise. * environ.c (make_environ): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * event-loop.c (create_file_handler): Likewise. (create_async_signal_handler): Likewise. (create_async_event_handler): Likewise. (create_timer): Likewise. * exec.c (build_section_table): Likewise. * fbsd-nat.c (fbsd_remember_child): Likewise. * fork-child.c (fork_inferior): Likewise. * frv-tdep.c (new_variant): Likewise. * gdbarch.sh (gdbarch_alloc): Likewise. (append_name): Likewise. * gdbtypes.c (rank_function): Likewise. (copy_type_recursive): Likewise. (add_dyn_prop): Likewise. * gnu-nat.c (make_proc): Likewise. (make_inf): Likewise. (gnu_write_inferior): Likewise. * gnu-v3-abi.c (build_gdb_vtable_type): Likewise. (build_std_type_info_type): Likewise. * guile/scm-param.c (compute_enum_list): Likewise. * guile/scm-utils.c (gdbscm_parse_function_args): Likewise. * guile/scm-value.c (gdbscm_value_call): Likewise. * h8300-tdep.c (h8300_gdbarch_init): Likewise. * hppa-tdep.c (hppa_init_objfile_priv_data): Likewise. (read_unwind_info): Likewise. * ia64-tdep.c (ia64_gdbarch_init): Likewise. * infcall.c (dummy_frame_context_saver_setup): Likewise. (call_function_by_hand_dummy): Likewise. * infcmd.c (step_once): Likewise. (finish_forward): Likewise. (attach_command): Likewise. (notice_new_inferior): Likewise. * inferior.c (add_inferior_silent): Likewise. * infrun.c (add_displaced_stepping_state): Likewise. (save_infcall_control_state): Likewise. (save_inferior_ptid): Likewise. (_initialize_infrun): Likewise. * jit.c (bfd_open_from_target_memory): Likewise. (jit_gdbarch_data_init): Likewise. * language.c (add_language): Likewise. * linespec.c (decode_line_2): Likewise. * linux-nat.c (add_to_pid_list): Likewise. (add_initial_lwp): Likewise. * linux-thread-db.c (add_thread_db_info): Likewise. (record_thread): Likewise. (info_auto_load_libthread_db): Likewise. * m32c-tdep.c (m32c_gdbarch_init): Likewise. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * m68k-tdep.c (m68k_gdbarch_init): Likewise. * m88k-tdep.c (m88k_analyze_prologue): Likewise. * macrocmd.c (macro_define_command): Likewise. * macroexp.c (gather_arguments): Likewise. * macroscope.c (sal_macro_scope): Likewise. * macrotab.c (new_macro_table): Likewise. * mdebugread.c (push_parse_stack): Likewise. (parse_partial_symbols): Likewise. (parse_symbol): Likewise. (psymtab_to_symtab_1): Likewise. (new_block): Likewise. (new_psymtab): Likewise. (mdebug_build_psymtabs): Likewise. (add_pending): Likewise. (elfmdebug_build_psymtabs): Likewise. * mep-tdep.c (mep_gdbarch_init): Likewise. * mi/mi-main.c (mi_execute_command): Likewise. * mi/mi-parse.c (mi_parse_argv): Likewise. * minidebug.c (lzma_open): Likewise. * minsyms.c (terminate_minimal_symbol_table): Likewise. * mips-linux-nat.c (mips_linux_insert_watchpoint): Likewise. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * mt-tdep.c (mt_registers_info): Likewise. * nat/aarch64-linux.c (aarch64_linux_new_thread): Likewise. * nat/linux-btrace.c (linux_enable_bts): Likewise. (linux_enable_pt): Likewise. * nat/linux-osdata.c (linux_xfer_osdata_processes): Likewise. (linux_xfer_osdata_processgroups): Likewise. * nios2-tdep.c (nios2_gdbarch_init): Likewise. * nto-procfs.c (procfs_meminfo): Likewise. * objc-lang.c (start_msglist): Likewise. (selectors_info): Likewise. (classes_info): Likewise. (find_methods): Likewise. * objfiles.c (allocate_objfile): Likewise. (update_section_map): Likewise. * osabi.c (gdbarch_register_osabi): Likewise. (gdbarch_register_osabi_sniffer): Likewise. * parse.c (start_arglist): Likewise. * ppc-linux-nat.c (hwdebug_find_thread_points_by_tid): Likewise. (hwdebug_insert_point): Likewise. * printcmd.c (display_command): Likewise. (ui_printf): Likewise. * procfs.c (create_procinfo): Likewise. (load_syscalls): Likewise. (proc_get_LDT_entry): Likewise. (proc_update_threads): Likewise. * prologue-value.c (make_pv_area): Likewise. (pv_area_store): Likewise. * psymtab.c (extend_psymbol_list): Likewise. (init_psymbol_list): Likewise. (allocate_psymtab): Likewise. * python/py-inferior.c (add_thread_object): Likewise. * python/py-param.c (compute_enum_values): Likewise. * python/py-value.c (valpy_call): Likewise. * python/py-varobj.c (py_varobj_iter_next): Likewise. * python/python.c (ensure_python_env): Likewise. * record-btrace.c (record_btrace_start_replaying): Likewise. * record-full.c (record_full_reg_alloc): Likewise. (record_full_mem_alloc): Likewise. (record_full_end_alloc): Likewise. (record_full_core_xfer_partial): Likewise. * regcache.c (get_thread_arch_aspace_regcache): Likewise. * remote-fileio.c (remote_fileio_init_fd_map): Likewise. * remote-notif.c (remote_notif_state_allocate): Likewise. * remote.c (demand_private_info): Likewise. (remote_notif_stop_alloc_reply): Likewise. (remote_enable_btrace): Likewise. * reverse.c (save_bookmark_command): Likewise. * rl78-tdep.c (rl78_gdbarch_init): Likewise. * rx-tdep.c (rx_gdbarch_init): Likewise. * s390-linux-nat.c (s390_insert_watchpoint): Likewise. * ser-go32.c (dos_get_tty_state): Likewise. (dos_copy_tty_state): Likewise. * ser-mingw.c (ser_windows_open): Likewise. (ser_console_wait_handle): Likewise. (ser_console_get_tty_state): Likewise. (make_pipe_state): Likewise. (net_windows_open): Likewise. * ser-unix.c (hardwire_get_tty_state): Likewise. (hardwire_copy_tty_state): Likewise. * solib-aix.c (solib_aix_new_lm_info): Likewise. * solib-dsbt.c (dsbt_current_sos): Likewise. (dsbt_relocate_main_executable): Likewise. * solib-frv.c (frv_current_sos): Likewise. (frv_relocate_main_executable): Likewise. * solib-spu.c (spu_bfd_fopen): Likewise. * solib-svr4.c (lm_info_read): Likewise. (svr4_copy_library_list): Likewise. (svr4_default_sos): Likewise. * source.c (find_source_lines): Likewise. (line_info): Likewise. (add_substitute_path_rule): Likewise. * spu-linux-nat.c (spu_bfd_open): Likewise. * spu-tdep.c (info_spu_dma_cmdlist): Likewise. * stabsread.c (dbx_lookup_type): Likewise. (read_type): Likewise. (read_member_functions): Likewise. (read_struct_fields): Likewise. (read_baseclasses): Likewise. (read_args): Likewise. (_initialize_stabsread): Likewise. * stack.c (func_command): Likewise. * stap-probe.c (handle_stap_probe): Likewise. * symfile.c (addrs_section_sort): Likewise. (addr_info_make_relative): Likewise. (load_section_callback): Likewise. (add_symbol_file_command): Likewise. (init_filename_language_table): Likewise. * symtab.c (create_filename_seen_cache): Likewise. (sort_search_symbols_remove_dups): Likewise. (search_symbols): Likewise. * target.c (make_cleanup_restore_target_terminal): Likewise. * thread.c (new_thread): Likewise. (enable_thread_stack_temporaries): Likewise. (make_cleanup_restore_current_thread): Likewise. (thread_apply_all_command): Likewise. * tic6x-tdep.c (tic6x_gdbarch_init): Likewise. * top.c (gdb_readline_wrapper): Likewise. * tracefile-tfile.c (tfile_trace_file_writer_new): Likewise. * tracepoint.c (trace_find_line_command): Likewise. (all_tracepoint_actions_and_cleanup): Likewise. (make_cleanup_restore_current_traceframe): Likewise. (get_uploaded_tp): Likewise. (get_uploaded_tsv): Likewise. * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. (tui_alloc_win_info): Likewise. (tui_alloc_content): Likewise. (tui_add_content_elements): Likewise. * tui/tui-disasm.c (tui_find_disassembly_address): Likewise. (tui_set_disassem_content): Likewise. * ui-file.c (ui_file_new): Likewise. (stdio_file_new): Likewise. (tee_file_new): Likewise. * utils.c (make_cleanup_restore_integer): Likewise. (add_internal_problem_command): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise. * valops.c (find_oload_champ): Likewise. * value.c (allocate_value_lazy): Likewise. (record_latest_value): Likewise. (create_internalvar): Likewise. * varobj.c (install_variable): Likewise. (new_variable): Likewise. (new_root_variable): Likewise. (cppush): Likewise. (_initialize_varobj): Likewise. * windows-nat.c (windows_make_so): Likewise. * x86-nat.c (x86_add_process): Likewise. * xcoffread.c (arrange_linetable): Likewise. (allocate_include_entry): Likewise. (process_linenos): Likewise. (SYMBOL_DUP): Likewise. (xcoff_start_psymtab): Likewise. (xcoff_end_psymtab): Likewise. * xml-support.c (gdb_xml_parse_attr_ulongest): Likewise. * xtensa-tdep.c (xtensa_register_type): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/gdbserver/ChangeLog: * ax.c (gdb_parse_agent_expr): Likewise. (compile_bytecodes): Likewise. * dll.c (loaded_dll): Likewise. * event-loop.c (append_callback_event): Likewise. (create_file_handler): Likewise. (create_file_event): Likewise. * hostio.c (handle_open): Likewise. * inferiors.c (add_thread): Likewise. (add_process): Likewise. * linux-aarch64-low.c (aarch64_linux_new_process): Likewise. * linux-arm-low.c (arm_new_process): Likewise. (arm_new_thread): Likewise. * linux-low.c (add_to_pid_list): Likewise. (linux_add_process): Likewise. (handle_extended_wait): Likewise. (add_lwp): Likewise. (enqueue_one_deferred_signal): Likewise. (enqueue_pending_signal): Likewise. (linux_resume_one_lwp_throw): Likewise. (linux_resume_one_thread): Likewise. (linux_read_memory): Likewise. (linux_write_memory): Likewise. * linux-mips-low.c (mips_linux_new_process): Likewise. (mips_linux_new_thread): Likewise. (mips_add_watchpoint): Likewise. * linux-x86-low.c (initialize_low_arch): Likewise. * lynx-low.c (lynx_add_process): Likewise. * mem-break.c (set_raw_breakpoint_at): Likewise. (set_breakpoint): Likewise. (add_condition_to_breakpoint): Likewise. (add_commands_to_breakpoint): Likewise. (clone_agent_expr): Likewise. (clone_one_breakpoint): Likewise. * regcache.c (new_register_cache): Likewise. * remote-utils.c (look_up_one_symbol): Likewise. * server.c (queue_stop_reply): Likewise. (start_inferior): Likewise. (queue_stop_reply_callback): Likewise. (handle_target_event): Likewise. * spu-low.c (fetch_ppc_memory): Likewise. (store_ppc_memory): Likewise. * target.c (set_target_ops): Likewise. * thread-db.c (thread_db_load_search): Likewise. (try_thread_db_load_1): Likewise. * tracepoint.c (add_tracepoint): Likewise. (add_tracepoint_action): Likewise. (create_trace_state_variable): Likewise. (cmd_qtdpsrc): Likewise. (cmd_qtro): Likewise. (add_while_stepping_state): Likewise. * win32-low.c (child_add_thread): Likewise. (get_image_name): Likewise.
2015-08-26 23:16:07 +02:00
valid_disassembly_styles = XNEWVEC (const char *,
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
num_disassembly_styles + 1);
for (i = j = 0; disasm_options->name[i] != NULL; i++)
if (CONST_STRNEQ (disasm_options->name[i], "reg-names-"))
{
size_t offset = strlen ("reg-names-");
const char *style = disasm_options->name[i];
valid_disassembly_styles[j++] = &style[offset];
length = snprintf (rdptr, rest, "%s - %s\n", &style[offset],
disasm_options->description[i]);
rdptr += length;
rest -= length;
}
/* Mark the end of valid options. */
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
valid_disassembly_styles[num_disassembly_styles] = NULL;
/* Create the help text. */
Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy This patch starts from the desire to eliminate make_cleanup_ui_file_delete, but then goes beyond. It makes ui_file & friends a real C++ class hierarchy, and switches temporary ui_file-like objects to stack-based allocation. - mem_fileopen -> string_file mem_fileopen is replaced with a new string_file class that is treated as a value class created on the stack. This alone eliminates most make_cleanup_ui_file_delete calls, and, simplifies code a whole lot (diffstat shows around 1k loc dropped.) string_file's internal buffer is a std::string, thus the "string" in the name. This simplifies the implementation much, compared to mem_fileopen, which managed growing its internal buffer manually. - ui_file_as_string, ui_file_strdup, ui_file_obsavestring all gone The new string_file class has a string() method that provides direct writable access to the internal std::string buffer. This replaced ui_file_as_string, which forced a copy of the same data the stream had inside. With direct access via a writable reference, we can instead move the string out of the string_stream, avoiding deep string copying. Related, ui_file_xstrdup calls are replaced with xstrdup'ping the stream's string, and ui_file_obsavestring is replaced by obstack_copy0. With all those out of the way, getting rid of the weird ui_file_put mechanism was possible. - New ui_file::printf, ui_file::puts, etc. methods These simplify / clarify client code. I considered splitting client-code changes, like these, e.g.: - stb = mem_fileopen (); - fprintf_unfiltered (stb, "%s%s%s", - _("The valid values are:\n"), - regdesc, - _("The default is \"std\".")); + string_file stb; + stb.printf ("%s%s%s", + _("The valid values are:\n"), + regdesc, + _("The default is \"std\".")); In two steps, with the first step leaving fprintf_unfiltered (etc.) calls in place, and only afterwards do a pass to change all those to call stb.printf etc.. I didn't do that split, because (when I tried), it turned out to be pointless make-work: the first pass would have to touch the fprintf_unfiltered line anyway, to replace "stb" with "&stb". - gdb_fopen replaced with stack-based objects This avoids the need for cleanups or unique_ptr's. I.e., this: struct ui_file *file = gdb_fopen (filename, "w"); if (filename == NULL) perror_with_name (filename); cleanups = make_cleanup_ui_file_delete (file); // use file. do_cleanups (cleanups); is replaced with this: stdio_file file; if (!file.open (filename, "w")) perror_with_name (filename); // use file. - odd contorsions in null_file_write / null_file_fputs around when to call to_fputs / to_write eliminated. - Global null_stream object A few places that were allocating a ui_file in order to print to "nowhere" are adjusted to instead refer to a new 'null_stream' global stream. - TUI's tui_sfileopen eliminated. TUI's ui_file much simplified The TUI's ui_file was serving a dual purpose. It supported being used as string buffer, and supported being backed by a stdio FILE. The string buffer part is gone, replaced by using of string_file. The 'FILE *' support is now much simplified, by making the TUI's ui_file inherit from stdio_file. gdb/ChangeLog: 2017-02-02 Pedro Alves <palves@redhat.com> * ada-lang.c (type_as_string): Use string_file. * ada-valprint.c (ada_print_floating): Use string_file. * ada-varobj.c (ada_varobj_scalar_image) (ada_varobj_get_value_image): Use string_file. * aix-thread.c (aix_thread_extra_thread_info): Use string_file. * arm-tdep.c (_initialize_arm_tdep): Use string_printf. * breakpoint.c (update_inserted_breakpoint_locations) (insert_breakpoint_locations, reattach_breakpoints) (print_breakpoint_location, print_one_detail_ranged_breakpoint) (print_it_watchpoint): Use string_file. (save_breakpoints): Use stdio_file. * c-exp.y (oper): Use string_file. * cli/cli-logging.c (set_logging_redirect): Use ui_file_up and tee_file. (pop_output_files): Use delete. (handle_redirections): Use stdio_file and tee_file. * cli/cli-setshow.c (do_show_command): Use string_file. * compile/compile-c-support.c (c_compute_program): Use string_file. * compile/compile-c-symbols.c (generate_vla_size): Take a 'string_file &' instead of a 'ui_file *'. (generate_c_for_for_one_variable): Take a 'string_file &' instead of a 'ui_file *'. Use string_file. (generate_c_for_variable_locations): Take a 'string_file &' instead of a 'ui_file *'. * compile/compile-internal.h (generate_c_for_for_one_variable): Take a 'string_file &' instead of a 'ui_file *'. * compile/compile-loc2c.c (push, pushf, unary, binary) (print_label, pushf_register_address, pushf_register) (do_compile_dwarf_expr_to_c): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * compile/compile.c (compile_to_object): Use string_file. * compile/compile.h (compile_dwarf_expr_to_c) (compile_dwarf_bounds_to_c): Take a 'string_file &' instead of a 'ui_file *'. * cp-support.c (inspect_type): Use string_file and obstack_copy0. (replace_typedefs_qualified_name): Use string_file and obstack_copy0. * disasm.c (gdb_pretty_print_insn): Use string_file. (gdb_disassembly): Adjust reference the null_stream global. (do_ui_file_delete): Delete. (gdb_insn_length): Use null_stream. * dummy-frame.c (maintenance_print_dummy_frames): Use stdio_file. * dwarf2loc.c (dwarf2_compile_property_to_c) (locexpr_generate_c_location, loclist_generate_c_location): Take a 'string_file &' instead of a 'ui_file *'. * dwarf2loc.h (dwarf2_compile_property_to_c): Likewise. * dwarf2read.c (do_ui_file_peek_last): Delete. (dwarf2_compute_name): Use string_file. * event-top.c (gdb_setup_readline): Use stdio_file. * gdbarch.sh (verify_gdbarch): Use string_file. * gdbtypes.c (safe_parse_type): Use null_stream. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Use string_file. * guile/scm-disasm.c (gdbscm_print_insn_from_port): Take a 'string_file *' instead of a 'ui_file *'. (gdbscm_arch_disassemble): Use string_file. * guile/scm-frame.c (frscm_print_frame_smob): Use string_file. * guile/scm-ports.c (class ioscm_file_port): Now a class that inherits from ui_file. (ioscm_file_port_delete, ioscm_file_port_rewind) (ioscm_file_port_put): Delete. (ioscm_file_port_write): Rename to ... (ioscm_file_port::write): ... this. Remove file_port_magic checks. (ioscm_file_port_new): Delete. (ioscm_with_output_to_port_worker): Use ioscm_file_port and ui_file_up. * guile/scm-type.c (tyscm_type_name): Use string_file. * guile/scm-value.c (vlscm_print_value_smob, gdbscm_value_print): Use string_file. * infcmd.c (print_return_value_1): Use string_file. * infrun.c (print_target_wait_results): Use string_file. * language.c (add_language): Use string_file. * location.c (explicit_to_string_internal): Use string_file. * main.c (captured_main_1): Use null_file. * maint.c (maintenance_print_architecture): Use stdio_file. * mi/mi-cmd-stack.c (list_arg_or_local): Use string_file. * mi/mi-common.h (struct mi_interp) <out, err, log, targ, event_channel>: Change type to mi_console_file pointer. * mi/mi-console.c (mi_console_file_fputs, mi_console_file_flush) (mi_console_file_delete): Delete. (struct mi_console_file): Delete. (mi_console_file_magic): Delete. (mi_console_file_new): Delete. (mi_console_file::mi_console_file): New. (mi_console_file_delete): Delete. (mi_console_file_fputs): Delete. (mi_console_file::write): New. (mi_console_raw_packet): Delete. (mi_console_file::flush): New. (mi_console_file_flush): Delete. (mi_console_set_raw): Rename to ... (mi_console_file::set_raw): ... this. * mi/mi-console.h (class mi_console_file): New class. (mi_console_file_new, mi_console_set_raw): Delete. * mi/mi-interp.c (mi_interpreter_init): Use mi_console_file. (mi_set_logging): Use delete and tee_file. Adjust. * mi/mi-main.c (output_register): Use string_file. (mi_cmd_data_evaluate_expression): Use string_file. (mi_cmd_data_read_memory): Use string_file. (mi_cmd_execute, print_variable_or_computed): Use string_file. * mi/mi-out.c (mi_ui_out::main_stream): New. (mi_ui_out::rewind): Use main_stream and string_file. (mi_ui_out::put): Use main_stream and string_file. (mi_ui_out::mi_ui_out): Remove 'stream' parameter. Allocate a 'string_file' instead. (mi_out_new): Don't allocate a mem_fileopen stream here. * mi/mi-out.h (mi_ui_out::mi_ui_out): Remove 'stream' parameter. (mi_ui_out::main_stream): Declare method. * printcmd.c (eval_command): Use string_file. * psymtab.c (maintenance_print_psymbols): Use stdio_file. * python/py-arch.c (archpy_disassemble): Use string_file. * python/py-breakpoint.c (bppy_get_commands): Use string_file. * python/py-frame.c (frapy_str): Use string_file. * python/py-framefilter.c (py_print_type, py_print_single_arg): Use string_file. * python/py-type.c (typy_str): Use string_file. * python/py-unwind.c (unwind_infopy_str): Use string_file. * python/py-value.c (valpy_str): Use string_file. * record-btrace.c (btrace_insn_history): Use string_file. * regcache.c (regcache_print): Use stdio_file. * reggroups.c (maintenance_print_reggroups): Use stdio_file. * remote.c (escape_buffer): Use string_file. * rust-lang.c (rust_get_disr_info): Use string_file. * serial.c (serial_open_ops_1): Use stdio_file. (do_serial_close): Use delete. * stack.c (print_frame_arg): Use string_file. (print_frame_args): Remove local mem_fileopen stream, not used. (print_frame): Use string_file. * symmisc.c (maintenance_print_symbols): Use stdio_file. * symtab.h (struct symbol_computed_ops) <generate_c_location>: Take a 'string_file *' instead of a 'ui_file *'. * top.c (new_ui): Use stdio_file and stderr_file. (free_ui): Use delete. (execute_command_to_string): Use string_file. (quit_confirm): Use string_file. * tracepoint.c (collection_list::append_exp): Use string_file. * tui/tui-disasm.c (tui_disassemble): Use string_file. * tui/tui-file.c: Don't include "ui-file.h". (enum streamtype, struct tui_stream): Delete. (tui_file_new, tui_file_delete, tui_fileopen, tui_sfileopen) (tui_file_isatty, tui_file_rewind, tui_file_put): Delete. (tui_file::tui_file): New method. (tui_file_fputs): Delete. (tui_file_get_strbuf): Delete. (tui_file::puts): New method. (tui_file_adjust_strbuf): Delete. (tui_file_flush): Delete. (tui_file::flush): New method. * tui/tui-file.h: Tweak intro comment. Include ui-file.h. (tui_fileopen, tui_sfileopen, tui_file_get_strbuf) (tui_file_adjust_strbuf): Delete declarations. (class tui_file): New class. * tui/tui-io.c (tui_initialize_io): Use tui_file. * tui/tui-regs.c (tui_restore_gdbout): Use delete. (tui_register_format): Use string_stream. * tui/tui-stack.c (tui_make_status_line): Use string_file. (tui_get_function_from_frame): Use string_file. * typeprint.c (type_to_string): Use string_file. * ui-file.c (struct ui_file, ui_file_magic, ui_file_new): Delete. (null_stream): New global. (ui_file_delete): Delete. (ui_file::ui_file): New. (null_file_isatty): Delete. (ui_file::~ui_file): New. (null_file_rewind): Delete. (ui_file::printf): New. (null_file_put): Delete. (null_file_flush): Delete. (ui_file::putstr): New. (null_file_write): Delete. (ui_file::putstrn): New. (null_file_read): Delete. (ui_file::putc): New. (null_file_fputs): Delete. (null_file_write_async_safe): Delete. (ui_file::vprintf): New. (null_file_delete): Delete. (null_file::write): New. (null_file_fseek): Delete. (null_file::puts): New. (ui_file_data): Delete. (null_file::write_async_safe): New. (gdb_flush, ui_file_isatty): Adjust. (ui_file_put, ui_file_rewind): Delete. (ui_file_write): Adjust. (ui_file_write_for_put): Delete. (ui_file_write_async_safe, ui_file_read): Adjust. (ui_file_fseek): Delete. (fputs_unfiltered): Adjust. (set_ui_file_flush, set_ui_file_isatty, set_ui_file_rewind) (set_ui_file_put, set_ui_file_write, set_ui_file_write_async_safe) (set_ui_file_read, set_ui_file_fputs, set_ui_file_fseek) (set_ui_file_data): Delete. (string_file::~string_file, string_file::write) (struct accumulated_ui_file, do_ui_file_xstrdup, ui_file_xstrdup) (do_ui_file_as_string, ui_file_as_string): Delete. (do_ui_file_obsavestring, ui_file_obsavestring): Delete. (struct mem_file): Delete. (mem_file_new): Delete. (stdio_file::stdio_file): New. (mem_file_delete): Delete. (stdio_file::stdio_file): New. (mem_fileopen): Delete. (stdio_file::~stdio_file): New. (mem_file_rewind): Delete. (stdio_file::set_stream): New. (mem_file_put): Delete. (stdio_file::open): New. (mem_file_write): Delete. (stdio_file_magic, struct stdio_file): Delete. (stdio_file_new, stdio_file_delete, stdio_file_flush): Delete. (stdio_file::flush): New. (stdio_file_read): Rename to ... (stdio_file::read): ... this. Adjust. (stdio_file_write): Rename to ... (stdio_file::write): ... this. Adjust. (stdio_file_write_async_safe): Rename to ... (stdio_file::write_async_safe) ... this. Adjust. (stdio_file_fputs): Rename to ... (stdio_file::puts) ... this. Adjust. (stdio_file_isatty): Delete. (stdio_file_fseek): Delete. (stdio_file::isatty): New. (stderr_file_write): Rename to ... (stderr_file::write) ... this. Adjust. (stderr_file_fputs): Rename to ... (stderr_file::puts) ... this. Adjust. (stderr_fileopen, stdio_fileopen, gdb_fopen): Delete. (stderr_file::stderr_file): New. (tee_file_magic): Delete. (struct tee_file): Delete. (tee_file::tee_file): New. (tee_file_new): Delete. (tee_file::~tee_file): New. (tee_file_delete): Delete. (tee_file_flush): Rename to ... (tee_file::flush): ... this. Adjust. (tee_file_write): Rename to ... (tee_file::write): ... this. Adjust. (tee_file::write_async_safe): New. (tee_file_fputs): Rename to ... (tee_file::puts): ... this. Adjust. (tee_file_isatty): Rename to ... (tee_file::isatty): ... this. Adjust. * ui-file.h (struct obstack, struct ui_file): Don't forward-declare. (ui_file_new, ui_file_flush_ftype, set_ui_file_flush) (ui_file_write_ftype) (set_ui_file_write, ui_file_fputs_ftype, set_ui_file_fputs) (ui_file_write_async_safe_ftype, set_ui_file_write_async_safe) (ui_file_read_ftype, set_ui_file_read, ui_file_isatty_ftype) (set_ui_file_isatty, ui_file_rewind_ftype, set_ui_file_rewind) (ui_file_put_method_ftype, ui_file_put_ftype, set_ui_file_put) (ui_file_delete_ftype, set_ui_file_data, ui_file_fseek_ftype) (set_ui_file_fseek): Delete. (ui_file_data, ui_file_delete, ui_file_rewind) (struct ui_file): New. (ui_file_up): New. (class null_file): New. (null_stream): Declare. (ui_file_write_for_put, ui_file_put): Delete. (ui_file_xstrdup, ui_file_as_string, ui_file_obsavestring): Delete. (ui_file_fseek, mem_fileopen, stdio_fileopen, stderr_fileopen) (gdb_fopen, tee_file_new): Delete. (struct string_file): New. (struct stdio_file): New. (stdio_file_up): New. (struct stderr_file): New. (class tee_file): New. * ui-out.c (ui_out::field_stream): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * ui-out.h (class ui_out) <field_stream>: Likewise. * utils.c (do_ui_file_delete, make_cleanup_ui_file_delete) (null_stream): Delete. (error_stream): Take a 'string_file &' instead of a 'ui_file *'. Adjust. * utils.h (struct ui_file): Delete forward declaration.. (make_cleanup_ui_file_delete, null_stream): Delete declarations. (error_stream): Take a 'string_file &' instead of a 'ui_file *'. * varobj.c (varobj_value_get_print_value): Use string_file. * xtensa-tdep.c (xtensa_verify_config): Use string_file. * gdbarch.c: Regenerate.
2017-02-02 12:11:47 +01:00
std::string helptext = string_printf ("%s%s%s",
_("The valid values are:\n"),
regdesc,
_("The default is \"std\"."));
1999-12-22 22:45:38 +01:00
add_setshow_enum_cmd("disassembler", no_class,
valid_disassembly_styles, &disassembly_style,
_("Set the disassembly style."),
_("Show the disassembly style."),
helptext.c_str (),
set_disassembly_style_sfunc,
GDB: Add support for the new set/show disassembler-options commands. This commit adds support to GDB so that it can modify the disassembler-options value that is passed to the disassembler, similar to objdump's -M option. Currently, the only supported targets are ARM, PowerPC and S/390, but adding support for a new target(s) is not difficult. include/ * dis-asm.h (disasm_options_t): New typedef. (parse_arm_disassembler_option): Remove prototype. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (get_arm_regname_num_options): Likewise. (disassemble_init_s390): New prototype. (disassembler_options_powerpc): Likewise. (disassembler_options_arm): Likewise. (disassembler_options_s390): Likewise. (remove_whitespace_and_extra_commas): Likewise. (disassembler_options_cmp): Likewise. (next_disassembler_option): New inline function. (FOR_EACH_DISASSEMBLER_OPTION): New macro. opcodes/ * disassemble.c Include "safe-ctype.h". (disassemble_init_for_target): Handle s390 init. (remove_whitespace_and_extra_commas): New function. (disassembler_options_cmp): Likewise. * arm-dis.c: Include "libiberty.h". (NUM_ELEM): Delete. (regnames): Use long disassembler style names. Add force-thumb and no-force-thumb options. (NUM_ARM_REGNAMES): Rename from this... (NUM_ARM_OPTIONS): ...to this. Use ARRAY_SIZE. (get_arm_regname_num_options): Delete. (set_arm_regname_option): Likewise. (get_arm_regnames): Likewise. (parse_disassembler_options): Likewise. (parse_arm_disassembler_option): Rename from this... (parse_arm_disassembler_options): ...to this. Make static. Use new FOR_EACH_DISASSEMBLER_OPTION macro to scan over options. (print_insn): Use parse_arm_disassembler_options. (disassembler_options_arm): New function. (print_arm_disassembler_options): Handle updated regnames. * ppc-dis.c: Include "libiberty.h". (ppc_opts): Add "32" and "64" entries. (ppc_parse_cpu): Use ARRAY_SIZE and disassembler_options_cmp. (powerpc_init_dialect): Add break to switch statement. Use new FOR_EACH_DISASSEMBLER_OPTION macro. (disassembler_options_powerpc): New function. (print_ppc_disassembler_options): Use ARRAY_SIZE. Remove printing of "32" and "64". * s390-dis.c: Include "libiberty.h". (init_flag): Remove unneeded variable. (struct s390_options_t): New structure type. (options): New structure. (init_disasm): Rename from this... (disassemble_init_s390): ...to this. Add initializations for current_arch_mask and option_use_insn_len_bits_p. Remove init_flag. (print_insn_s390): Delete call to init_disasm. (disassembler_options_s390): New function. (print_s390_disassembler_options): Print using information from struct 'options'. * po/opcodes.pot: Regenerate. binutils/ * objdump.c (main): Use remove_whitespace_and_extra_commas. gdb/ * NEWS: Mention new set/show disassembler-options commands. * doc/gdb.texinfo: Document new set/show disassembler-options commands. * disasm.c: Include "arch-utils.h", "gdbcmd.h" and "safe-ctype.h". (prospective_options): New static variable. (gdb_disassembler::gdb_disassembler): Initialize m_di.disassembler_options. (gdb_buffered_insn_length_init_dis): Initilize di->disassembler_options. (get_disassembler_options): New function. (set_disassembler_options): Likewise. (set_disassembler_options_sfunc): Likewise. (show_disassembler_options_sfunc): Likewise. (disassembler_options_completer): Likewise. (_initialize_disasm): Likewise. * disasm.h (get_disassembler_options): New prototype. (set_disassembler_options): Likewise. * gdbarch.sh (gdbarch_disassembler_options): New variable. (gdbarch_verify_disassembler_options): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * arm-tdep.c (num_disassembly_options): Delete. (set_disassembly_style): Likewise. (arm_disassembler_options): New static variable. (set_disassembly_style_sfunc): Convert short style name into long option name. Call set_disassembler_options. (show_disassembly_style_sfunc): New function. (arm_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. (_initialize_arm_tdep): Delete regnames variable and update callers. (arm_disassembler_options): Initialize. (disasm_options): New variable. (num_disassembly_options): Rename from this... (num_disassembly_styles): ...to this. Compute by scanning through disasm_options. (valid_disassembly_styles): Initialize using disasm_options. Remove calls to parse_arm_disassembler_option, get_arm_regnames and set_arm_regname_option. Pass show_disassembly_style_sfunc to the "disassembler" setshow command. * rs6000-tdep.c (powerpc_disassembler_options): New static variable. (rs6000_gdbarch_init): Call set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. * s390-tdep.c (s390_disassembler_options): New static variable. (s390_gdbarch_init):all set_gdbarch_disassembler_options and set_gdbarch_verify_disassembler_options. gdb/testsuite/ * gdb.arch/powerpc-power.exp: Delete test. * gdb.arch/powerpc-power.s: Likewise. * gdb.disasm/disassembler-options.exp: New test. * gdb.arch/powerpc-altivec.exp: Likewise. * gdb.arch/powerpc-altivec.s: Likewise. * gdb.arch/powerpc-altivec2.exp: Likewise. * gdb.arch/powerpc-altivec2.s: Likewise. * gdb.arch/powerpc-altivec3.exp: Likewise. * gdb.arch/powerpc-altivec3.s: Likewise. * gdb.arch/powerpc-power7.exp: Likewise. * gdb.arch/powerpc-power7.s: Likewise. * gdb.arch/powerpc-power8.exp: Likewise. * gdb.arch/powerpc-power8.s: Likewise. * gdb.arch/powerpc-power9.exp: Likewise. * gdb.arch/powerpc-power9.s: Likewise. * gdb.arch/powerpc-vsx.exp: Likewise. * gdb.arch/powerpc-vsx.s: Likewise. * gdb.arch/powerpc-vsx2.exp: Likewise. * gdb.arch/powerpc-vsx2.s: Likewise. * gdb.arch/powerpc-vsx3.exp: Likewise. * gdb.arch/powerpc-vsx3.s: Likewise. * gdb.arch/arm-disassembler-options.exp: Likewise. * gdb.arch/powerpc-disassembler-options.exp: Likewise. * gdb.arch/s390-disassembler-options.exp: Likewise.
2017-02-28 19:32:07 +01:00
show_disassembly_style_sfunc,
&setarmcmdlist, &showarmcmdlist);
add_setshow_boolean_cmd ("apcs32", no_class, &arm_apcs_32,
_("Set usage of ARM 32-bit mode."),
_("Show usage of ARM 32-bit mode."),
_("When off, a 26-bit PC will be used."),
NULL,
2011-01-07 Michael Snyder <msnyder@vmware.com> * ada-lang.c: Comment cleanup, mostly periods and spaces. * ada-lang.h: Ditto. * ada-tasks.c: Ditto. * ada-valprint.c: Ditto. * aix-threads.c: Ditto. * alpha-linux-nat.c: Ditto. * alpha-linux-tdep.c: Ditto. * alpha-mdebug-tdep.c: Ditto. * alpha-nat.c: Ditto. * alpha-osf1-tdep.c: Ditto. * alpha-tdep.c: Ditto. * alphabsd-nat.c: Ditto. * alphabsd-tdep.c: Ditto. * amd64-darwin-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * amd64-sol2-tdep.c: Ditto. * amd64-tdep.c: Ditto. * amd64-fbsd-tdep.c: Ditto. * amd64-nbsd-tdep.c: Ditto. * amd64-obsd-tdep.c: Ditto. * amd64-linux-nat.c: Ditto. * amd64-linux-tdep.c: Ditto. * arm-tdep.c: Ditto. * arm-tdep.h: Ditto. * armnbsd-nat.c: Ditto. * avr-tdep.c: Ditto. * bfin-tdep.c: Ditto. * bsd-kvm.c: Ditto. * c-typeprintc: Ditto. * c-valprint.c: Ditto. * coff-pe-read.h: Ditto. * coffreead.c: Ditto. * cris-tdep.c: Ditto. * d-lang.c: Ditto. * darwin-nat-info.c: Ditto. * darwin-nat.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * dcache.c: Ditto. * dcache.h: Ditto. * dec-thread.c: Ditto. * defs.h: Ditto. * demangle.c: Ditto. * dicos-tdep.c: Ditto. * dictionary.c: Ditto. * dictionary.h: Ditto. * dink32-rom.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dsrec.c: Ditto. * dummy-frame.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * environ.c: Ditto. * eval.c: Ditto. * event-top.h: Ditto. * exceptions.c: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-exp.y: Ditto. * f-lang.c: Ditto. * f-lang.h: Ditto. * f-typeprint.c: Ditto. * f-valprint.c: Ditto. * fbsd-nat.c: Ditto. * findvar.c: Ditto. * fork-child.c: Ditto. * frame.c: Ditto. * frame.h: Ditto. * frv-linux-tdep.c: Ditto. * frv-tdep.c: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_string.h: Ditto. * gdb_thread_db.h: Ditto. * gdb_wait.h: Ditto. * gdbarch.sh: Ditto. * gdbcore.h: Ditto. * gdbthread.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * gnu-nat.c: Ditto. * gnu-nat.h: Ditto. * gnu-v2-abi.c: Ditto. * gnu-v3-abi.c: Ditto. * go32-nat.c: Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate.
2011-01-07 20:36:19 +01:00
NULL, /* FIXME: i18n: Usage of ARM 32-bit
mode is %s. */
&setarmcmdlist, &showarmcmdlist);
/* Add a command to allow the user to force the FPU model. */
add_setshow_enum_cmd ("fpu", no_class, fp_model_strings, &current_fp_model,
_("Set the floating point type."),
_("Show the floating point type."),
_("auto - Determine the FP typefrom the OS-ABI.\n\
softfpa - Software FP, mixed-endian doubles on little-endian ARMs.\n\
fpa - FPA co-processor (GCC compiled).\n\
softvfp - Software FP with pure-endian doubles.\n\
vfp - VFP co-processor."),
set_fp_model_sfunc, show_fp_model,
&setarmcmdlist, &showarmcmdlist);
/* Add a command to allow the user to force the ABI. */
add_setshow_enum_cmd ("abi", class_support, arm_abi_strings, &arm_abi_string,
_("Set the ABI."),
_("Show the ABI."),
NULL, arm_set_abi, arm_show_abi,
&setarmcmdlist, &showarmcmdlist);
/* Add two commands to allow the user to force the assumed
execution mode. */
add_setshow_enum_cmd ("fallback-mode", class_support,
arm_mode_strings, &arm_fallback_mode_string,
_("Set the mode assumed when symbols are unavailable."),
_("Show the mode assumed when symbols are unavailable."),
NULL, NULL, arm_show_fallback_mode,
&setarmcmdlist, &showarmcmdlist);
add_setshow_enum_cmd ("force-mode", class_support,
arm_mode_strings, &arm_force_mode_string,
_("Set the mode assumed even when symbols are available."),
_("Show the mode assumed even when symbols are available."),
NULL, NULL, arm_show_force_mode,
&setarmcmdlist, &showarmcmdlist);
/* Debugging flag. */
add_setshow_boolean_cmd ("arm", class_maintenance, &arm_debug,
_("Set ARM debugging."),
_("Show ARM debugging."),
_("When on, arm-specific debugging is enabled."),
NULL,
NULL, /* FIXME: i18n: "ARM debugging is %s. */
&setdebuglist, &showdebuglist);
#if GDB_SELF_TEST
Add selftests run filtering With the growing number of selftests, I think it would be useful to be able to run only a subset of the tests. This patch associates a name to each registered selftest. It then allows doing something like: (gdb) maintenance selftest aarch64 Running self-tests. Running selftest aarch64-analyze-prologue. Running selftest aarch64-process-record. Ran 2 unit tests, 0 failed or with gdbserver: ./gdbserver --selftest=aarch64 In both cases, only the tests that contain "aarch64" in their name are ran. To help validate that the tests you want to run were actually ran, it also prints a message with the test name before running each test. Right now, all the arch-dependent tests are registered as a single test of the selftests. To be able to filter those too, I made them "first-class citizen" selftests. The selftest type is an interface, with different implementations for "simple selftests" and "arch selftests". The run_tests function simply iterates on that an invokes operator() on each test. I changed the tests data structure from a vector to a map, because - it allows iterating in a stable (alphabetical) order - it allows to easily verify if a test with a given name has been registered, to avoid duplicates There's also a new command "maintenance info selftests" that lists the registered selftests. gdb/ChangeLog: * common/selftest.h (selftest): New struct/interface. (register_test): Add name parameter, add new overload. (run_tests): Add filter parameter. (for_each_selftest_ftype): New typedef. (for_each_selftest): New declaration. * common/selftest.c (tests): Change type to map<string, unique_ptr<selftest>>. (simple_selftest): New struct. (register_test): New function. (register_test): Add name parameter and use it. (run_tests): Add filter parameter and use it. Add prints. Adjust to vector -> map change. * aarch64-tdep.c (_initialize_aarch64_tdep): Add names when registering selftests. * arm-tdep.c (_initialize_arm_tdep): Likewise. * disasm-selftests.c (_initialize_disasm_selftests): Likewise. * dwarf2-frame.c (_initialize_dwarf2_frame): Likewise. * dwarf2loc.c (_initialize_dwarf2loc): Likewise. * findvar.c (_initialize_findvar): Likewise. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Likewise. * maint.c (maintenance_selftest): Update call to run_tests. (maintenance_info_selftests): New function. (_initialize_maint_cmds): Register "maintenance info selftests" command. Update "maintenance selftest" doc. * regcache.c (_initialize_regcache): Add names when registering selftests. * rust-exp.y (_initialize_rust_exp): Likewise. * selftest-arch.c (gdbarch_selftest): New struct. (gdbarch_tests): Remove. (register_test_foreach_arch): Add name parameter. Call register_test. (tests_with_arch): Remove, move most content to gdbarch_selftest::operator(). (_initialize_selftests_foreach_arch): Remove. * selftest-arch.h (register_test_foreach_arch): Add name parameter. (run_tests_with_arch): New declaration. * utils-selftests.c (_initialize_utils_selftests): Add names when registering selftests. * utils.c (_initialize_utils): Likewise. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Likewise. * unittests/environ-selftests.c (_initialize_environ_selftests): Likewise. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Likewise. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Likewise. * unittests/optional-selftests.c (_initialize_optional_selftests): Likewise. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Likewise. * NEWS: Document "maintenance selftest" and "maint info selftests". gdb/gdbserver/ChangeLog: * server.c (captured_main): Accept argument for --selftest. Update run_tests call. * linux-x86-tdesc-selftest.c (initialize_low_tdesc): Add names when registering selftests. gdb/doc/ChangeLog: * gdb.texinfo (Maintenance Commands): Document filter parameter of "maint selftest". Document "maint info selftests" command.
2017-09-16 14:06:03 +02:00
selftests::register_test ("arm-record", selftests::arm_record_test);
#endif
}
/* ARM-reversible process record data structures. */
#define ARM_INSN_SIZE_BYTES 4
#define THUMB_INSN_SIZE_BYTES 2
#define THUMB2_INSN_SIZE_BYTES 4
/* Position of the bit within a 32-bit ARM instruction
that defines whether the instruction is a load or store. */
#define INSN_S_L_BIT_NUM 20
#define REG_ALLOC(REGS, LENGTH, RECORD_BUF) \
do \
{ \
unsigned int reg_len = LENGTH; \
if (reg_len) \
{ \
REGS = XNEWVEC (uint32_t, reg_len); \
memcpy(&REGS[0], &RECORD_BUF[0], sizeof(uint32_t)*LENGTH); \
} \
} \
while (0)
#define MEM_ALLOC(MEMS, LENGTH, RECORD_BUF) \
do \
{ \
unsigned int mem_len = LENGTH; \
if (mem_len) \
{ \
MEMS = XNEWVEC (struct arm_mem_r, mem_len); \
memcpy(&MEMS->len, &RECORD_BUF[0], \
sizeof(struct arm_mem_r) * LENGTH); \
} \
} \
while (0)
/* Checks whether insn is already recorded or yet to be decoded. (boolean expression). */
#define INSN_RECORDED(ARM_RECORD) \
(0 != (ARM_RECORD)->reg_rec_count || 0 != (ARM_RECORD)->mem_rec_count)
/* ARM memory record structure. */
struct arm_mem_r
{
uint32_t len; /* Record length. */
uint32_t addr; /* Memory address. */
};
/* ARM instruction record contains opcode of current insn
and execution state (before entry to decode_insn()),
contains list of to-be-modified registers and
memory blocks (on return from decode_insn()). */
typedef struct insn_decode_record_t
{
struct gdbarch *gdbarch;
struct regcache *regcache;
CORE_ADDR this_addr; /* Address of the insn being decoded. */
uint32_t arm_insn; /* Should accommodate thumb. */
uint32_t cond; /* Condition code. */
uint32_t opcode; /* Insn opcode. */
uint32_t decode; /* Insn decode bits. */
uint32_t mem_rec_count; /* No of mem records. */
uint32_t reg_rec_count; /* No of reg records. */
uint32_t *arm_regs; /* Registers to be saved for this record. */
struct arm_mem_r *arm_mems; /* Memory to be saved for this record. */
} insn_decode_record;
/* Checks ARM SBZ and SBO mandatory fields. */
static int
sbo_sbz (uint32_t insn, uint32_t bit_num, uint32_t len, uint32_t sbo)
{
uint32_t ones = bits (insn, bit_num - 1, (bit_num -1) + (len - 1));
if (!len)
return 1;
if (!sbo)
ones = ~ones;
while (ones)
{
if (!(ones & sbo))
{
return 0;
}
ones = ones >> 1;
}
return 1;
}
enum arm_record_result
{
ARM_RECORD_SUCCESS = 0,
ARM_RECORD_FAILURE = 1
};
typedef enum
{
ARM_RECORD_STRH=1,
ARM_RECORD_STRD
} arm_record_strx_t;
typedef enum
{
ARM_RECORD=1,
THUMB_RECORD,
THUMB2_RECORD
} record_type_t;
static int
arm_record_strx (insn_decode_record *arm_insn_r, uint32_t *record_buf,
uint32_t *record_buf_mem, arm_record_strx_t str_type)
{
struct regcache *reg_cache = arm_insn_r->regcache;
ULONGEST u_regval[2]= {0};
uint32_t reg_src1 = 0, reg_src2 = 0;
uint32_t immed_high = 0, immed_low = 0,offset_8 = 0, tgt_mem_addr = 0;
arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 21, 24);
arm_insn_r->decode = bits (arm_insn_r->arm_insn, 4, 7);
if (14 == arm_insn_r->opcode || 10 == arm_insn_r->opcode)
{
/* 1) Handle misc store, immediate offset. */
immed_low = bits (arm_insn_r->arm_insn, 0, 3);
immed_high = bits (arm_insn_r->arm_insn, 8, 11);
reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1,
&u_regval[0]);
if (ARM_PC_REGNUM == reg_src1)
{
/* If R15 was used as Rn, hence current PC+8. */
u_regval[0] = u_regval[0] + 8;
}
offset_8 = (immed_high << 4) | immed_low;
/* Calculate target store address. */
if (14 == arm_insn_r->opcode)
{
tgt_mem_addr = u_regval[0] + offset_8;
}
else
{
tgt_mem_addr = u_regval[0] - offset_8;
}
if (ARM_RECORD_STRH == str_type)
{
record_buf_mem[0] = 2;
record_buf_mem[1] = tgt_mem_addr;
arm_insn_r->mem_rec_count = 1;
}
else if (ARM_RECORD_STRD == str_type)
{
record_buf_mem[0] = 4;
record_buf_mem[1] = tgt_mem_addr;
record_buf_mem[2] = 4;
record_buf_mem[3] = tgt_mem_addr + 4;
arm_insn_r->mem_rec_count = 2;
}
}
else if (12 == arm_insn_r->opcode || 8 == arm_insn_r->opcode)
{
/* 2) Store, register offset. */
/* Get Rm. */
reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
/* Get Rn. */
reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
if (15 == reg_src2)
{
/* If R15 was used as Rn, hence current PC+8. */
u_regval[0] = u_regval[0] + 8;
}
/* Calculate target store address, Rn +/- Rm, register offset. */
if (12 == arm_insn_r->opcode)
{
tgt_mem_addr = u_regval[0] + u_regval[1];
}
else
{
tgt_mem_addr = u_regval[1] - u_regval[0];
}
if (ARM_RECORD_STRH == str_type)
{
record_buf_mem[0] = 2;
record_buf_mem[1] = tgt_mem_addr;
arm_insn_r->mem_rec_count = 1;
}
else if (ARM_RECORD_STRD == str_type)
{
record_buf_mem[0] = 4;
record_buf_mem[1] = tgt_mem_addr;
record_buf_mem[2] = 4;
record_buf_mem[3] = tgt_mem_addr + 4;
arm_insn_r->mem_rec_count = 2;
}
}
else if (11 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
|| 2 == arm_insn_r->opcode || 6 == arm_insn_r->opcode)
{
/* 3) Store, immediate pre-indexed. */
/* 5) Store, immediate post-indexed. */
immed_low = bits (arm_insn_r->arm_insn, 0, 3);
immed_high = bits (arm_insn_r->arm_insn, 8, 11);
offset_8 = (immed_high << 4) | immed_low;
reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
/* Calculate target store address, Rn +/- Rm, register offset. */
if (15 == arm_insn_r->opcode || 6 == arm_insn_r->opcode)
{
tgt_mem_addr = u_regval[0] + offset_8;
}
else
{
tgt_mem_addr = u_regval[0] - offset_8;
}
if (ARM_RECORD_STRH == str_type)
{
record_buf_mem[0] = 2;
record_buf_mem[1] = tgt_mem_addr;
arm_insn_r->mem_rec_count = 1;
}
else if (ARM_RECORD_STRD == str_type)
{
record_buf_mem[0] = 4;
record_buf_mem[1] = tgt_mem_addr;
record_buf_mem[2] = 4;
record_buf_mem[3] = tgt_mem_addr + 4;
arm_insn_r->mem_rec_count = 2;
}
/* Record Rn also as it changes. */
*(record_buf) = bits (arm_insn_r->arm_insn, 16, 19);
arm_insn_r->reg_rec_count = 1;
}
else if (9 == arm_insn_r->opcode || 13 == arm_insn_r->opcode
|| 0 == arm_insn_r->opcode || 4 == arm_insn_r->opcode)
{
/* 4) Store, register pre-indexed. */
/* 6) Store, register post -indexed. */
reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
/* Calculate target store address, Rn +/- Rm, register offset. */
if (13 == arm_insn_r->opcode || 4 == arm_insn_r->opcode)
{
tgt_mem_addr = u_regval[0] + u_regval[1];
}
else
{
tgt_mem_addr = u_regval[1] - u_regval[0];
}
if (ARM_RECORD_STRH == str_type)
{
record_buf_mem[0] = 2;
record_buf_mem[1] = tgt_mem_addr;
arm_insn_r->mem_rec_count = 1;
}
else if (ARM_RECORD_STRD == str_type)
{
record_buf_mem[0] = 4;
record_buf_mem[1] = tgt_mem_addr;
record_buf_mem[2] = 4;
record_buf_mem[3] = tgt_mem_addr + 4;
arm_insn_r->mem_rec_count = 2;
}
/* Record Rn also as it changes. */
*(record_buf) = bits (arm_insn_r->arm_insn, 16, 19);
arm_insn_r->reg_rec_count = 1;
}
return 0;
}
/* Handling ARM extension space insns. */
static int
arm_record_extension_space (insn_decode_record *arm_insn_r)
{
int ret = 0; /* Return value: -1:record failure ; 0:success */
uint32_t opcode1 = 0, opcode2 = 0, insn_op1 = 0;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t reg_src1 = 0;
struct regcache *reg_cache = arm_insn_r->regcache;
ULONGEST u_regval = 0;
gdb_assert (!INSN_RECORDED(arm_insn_r));
/* Handle unconditional insn extension space. */
opcode1 = bits (arm_insn_r->arm_insn, 20, 27);
opcode2 = bits (arm_insn_r->arm_insn, 4, 7);
if (arm_insn_r->cond)
{
/* PLD has no affect on architectural state, it just affects
the caches. */
if (5 == ((opcode1 & 0xE0) >> 5))
{
/* BLX(1) */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
/* STC2, LDC2, MCR2, MRC2, CDP2: <TBD>, co-processor insn. */
}
opcode1 = bits (arm_insn_r->arm_insn, 25, 27);
if (3 == opcode1 && bit (arm_insn_r->arm_insn, 4))
{
ret = -1;
/* Undefined instruction on ARM V5; need to handle if later
versions define it. */
}
opcode1 = bits (arm_insn_r->arm_insn, 24, 27);
opcode2 = bits (arm_insn_r->arm_insn, 4, 7);
insn_op1 = bits (arm_insn_r->arm_insn, 20, 23);
/* Handle arithmetic insn extension space. */
if (!opcode1 && 9 == opcode2 && 1 != arm_insn_r->cond
&& !INSN_RECORDED(arm_insn_r))
{
/* Handle MLA(S) and MUL(S). */
if (in_inclusive_range (insn_op1, 0U, 3U))
{
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
else if (in_inclusive_range (insn_op1, 4U, 15U))
{
/* Handle SMLAL(S), SMULL(S), UMLAL(S), UMULL(S). */
record_buf[0] = bits (arm_insn_r->arm_insn, 16, 19);
record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[2] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 3;
}
}
opcode1 = bits (arm_insn_r->arm_insn, 26, 27);
opcode2 = bits (arm_insn_r->arm_insn, 23, 24);
insn_op1 = bits (arm_insn_r->arm_insn, 21, 22);
/* Handle control insn extension space. */
if (!opcode1 && 2 == opcode2 && !bit (arm_insn_r->arm_insn, 20)
&& 1 != arm_insn_r->cond && !INSN_RECORDED(arm_insn_r))
{
if (!bit (arm_insn_r->arm_insn,25))
{
if (!bits (arm_insn_r->arm_insn, 4, 7))
{
if ((0 == insn_op1) || (2 == insn_op1))
{
/* MRS. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
else if (1 == insn_op1)
{
/* CSPR is going to be changed. */
record_buf[0] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
else if (3 == insn_op1)
{
/* SPSR is going to be changed. */
/* We need to get SPSR value, which is yet to be done. */
return -1;
}
}
else if (1 == bits (arm_insn_r->arm_insn, 4, 7))
{
if (1 == insn_op1)
{
/* BX. */
record_buf[0] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
else if (3 == insn_op1)
{
/* CLZ. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
}
else if (3 == bits (arm_insn_r->arm_insn, 4, 7))
{
/* BLX. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
else if (5 == bits (arm_insn_r->arm_insn, 4, 7))
{
/* QADD, QSUB, QDADD, QDSUB */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 2;
}
else if (7 == bits (arm_insn_r->arm_insn, 4, 7))
{
/* BKPT. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
arm_insn_r->reg_rec_count = 2;
/* Save SPSR also;how? */
return -1;
}
else if(8 == bits (arm_insn_r->arm_insn, 4, 7)
|| 10 == bits (arm_insn_r->arm_insn, 4, 7)
|| 12 == bits (arm_insn_r->arm_insn, 4, 7)
|| 14 == bits (arm_insn_r->arm_insn, 4, 7)
)
{
if (0 == insn_op1 || 1 == insn_op1)
{
/* SMLA<x><y>, SMLAW<y>, SMULW<y>. */
/* We dont do optimization for SMULW<y> where we
need only Rd. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
else if (2 == insn_op1)
{
/* SMLAL<x><y>. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = bits (arm_insn_r->arm_insn, 16, 19);
arm_insn_r->reg_rec_count = 2;
}
else if (3 == insn_op1)
{
/* SMUL<x><y>. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
}
}
else
{
/* MSR : immediate form. */
if (1 == insn_op1)
{
/* CSPR is going to be changed. */
record_buf[0] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
else if (3 == insn_op1)
{
/* SPSR is going to be changed. */
/* we need to get SPSR value, which is yet to be done */
return -1;
}
}
}
opcode1 = bits (arm_insn_r->arm_insn, 25, 27);
opcode2 = bits (arm_insn_r->arm_insn, 20, 24);
insn_op1 = bits (arm_insn_r->arm_insn, 5, 6);
/* Handle load/store insn extension space. */
if (!opcode1 && bit (arm_insn_r->arm_insn, 7)
&& bit (arm_insn_r->arm_insn, 4) && 1 != arm_insn_r->cond
&& !INSN_RECORDED(arm_insn_r))
{
/* SWP/SWPB. */
if (0 == insn_op1)
{
/* These insn, changes register and memory as well. */
/* SWP or SWPB insn. */
/* Get memory address given by Rn. */
reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval);
/* SWP insn ?, swaps word. */
if (8 == arm_insn_r->opcode)
{
record_buf_mem[0] = 4;
}
else
{
/* SWPB insn, swaps only byte. */
record_buf_mem[0] = 1;
}
record_buf_mem[1] = u_regval;
arm_insn_r->mem_rec_count = 1;
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
else if (1 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
{
/* STRH. */
arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
ARM_RECORD_STRH);
}
else if (2 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
{
/* LDRD. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = record_buf[0] + 1;
arm_insn_r->reg_rec_count = 2;
}
else if (3 == insn_op1 && !bit (arm_insn_r->arm_insn, 20))
{
/* STRD. */
arm_record_strx(arm_insn_r, &record_buf[0], &record_buf_mem[0],
ARM_RECORD_STRD);
}
else if (bit (arm_insn_r->arm_insn, 20) && insn_op1 <= 3)
{
/* LDRH, LDRSB, LDRSH. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
}
opcode1 = bits (arm_insn_r->arm_insn, 23, 27);
if (24 == opcode1 && bit (arm_insn_r->arm_insn, 21)
&& !INSN_RECORDED(arm_insn_r))
{
ret = -1;
/* Handle coprocessor insn extension space. */
}
/* To be done for ARMv5 and later; as of now we return -1. */
if (-1 == ret)
return ret;
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (arm_insn_r->arm_mems, arm_insn_r->mem_rec_count, record_buf_mem);
return ret;
}
/* Handling opcode 000 insns. */
static int
arm_record_data_proc_misc_ld_str (insn_decode_record *arm_insn_r)
{
struct regcache *reg_cache = arm_insn_r->regcache;
uint32_t record_buf[8], record_buf_mem[8];
ULONGEST u_regval[2] = {0};
Simple unused variable removals This patch holds all the straightforward unused variable deletions. gdb/ChangeLog 2018-07-22 Tom Tromey <tom@tromey.com> * guile/scm-value.c (gdbscm_value_call): Remove unused variables. * guile/scm-math.c (vlscm_unop_gdbthrow, vlscm_binop_gdbthrow) (vlscm_convert_typed_value_from_scheme): Remove unused variable. * buildsym-legacy.c (get_macro_table): Remove unused variable. * stack.c (frame_apply_level_command): Remove unused variable. * tic6x-tdep.c (tic6x_push_dummy_call): Remove unused variable. * sparc64-tdep.c (adi_examine_command): Remove unused variable. * rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Remove unused variable. * nios2-tdep.c (nios2_push_dummy_call): Remove unused variable. * mep-tdep.c (mep_push_dummy_call): Remove unused variable. * ada-lang.c (ada_lookup_symbol_list_worker): Remove unused variable. * amd64-tdep.c (amd64_supply_xsave): Remove unused variable. * arm-tdep.c (arm_record_data_proc_misc_ld_str): Remove unused variable. * breakpoint.c (check_no_tracepoint_commands, update_watchpoint): Remove unused variable. * cli/cli-script.c (recurse_read_control_structure): Remove unused variable. * common/tdesc.c (print_xml_feature::visit): Remove unused variable. * compile/compile-object-load.c (store_regs): Remove unused variables. * complaints.c (clear_complaints): Remove unused variable. * corelow.c (core_target_open): Remove unused variable. * fbsd-tdep.c (fbsd_core_info_proc_status): Remove unused variable. * guile/scm-frame.c (gdbscm_frame_read_var): Remove unused variable. * guile/scm-symtab.c (stscm_print_sal_smob): Remove unused variable. * guile/scm-type.c (gdbscm_field_baseclass_p): Remove unused variable. * guile/scm-utils.c (gdbscm_parse_function_args): Remove unused variable. * hppa-tdep.c (hppa_stub_frame_unwind_cache): Remove unused variable. * ia64-tdep.c (examine_prologue): Remove unused variable. * infcall.c (run_inferior_call): Remove unused variable. * inferior.c (exit_inferior): Remove unused variable. * infrun.c (infrun_thread_ptid_changed): Remove unused variable. * linespec.c (decode_line_2): Remove unused variable. * linux-nat.c (super_close): Remove. * linux-tdep.c (linux_info_proc): Remove unused variable. * mi/mi-main.c (mi_execute_command): Remove unused variable. * microblaze-linux-tdep.c (microblaze_linux_sigtramp_cache): Remove unused variable. * parse.c (find_minsym_type_and_address): Remove unused variable. * printcmd.c (info_symbol_command, printf_floating): Remove unused variable. * python/py-breakpoint.c (bppy_set_commands): Remove unused variable. * python/py-unwind.c (unwind_infopy_dealloc): Remove unused variables. * record-btrace.c (record_btrace_target::store_registers): Remove unused variable. (cmd_show_record_btrace_cpu): Remove unused variable. * riscv-tdep.c (riscv_register_reggroup_p) (riscv_push_dummy_call, riscv_return_value): Remove unused variable. * rust-exp.y (literal): Remove unused variable. * rust-lang.c (rust_evaluate_subexp) <OP_RUST_ARARAY>: Remove unused variable. <STRUCTOP_ANONYMOUS>: Likewise. * s390-linux-tdep.c (s390_linux_init_abi_31) (s390_linux_init_abi_64): Remove unused variable. * ser-ming2.c (ser_windows_read_prim, pipe_select_thread) (file_select_thread, net_windows_open, _initialize_ser_windows): Remove unused variables. * symtab.c (find_pc_sect_line): Remove unused variable. * target-memory.c (compute_garbled_blocks): Remove unused variable. (target_write_memory_blocks): Remove unused variable. * target.c (target_stack::unpush): Remove unused variables. * tracepoint.c (start_tracing, all_tracepoint_actions) (merge_uploaded_trace_state_variables) (print_one_static_tracepoint_marker): Remove unused variable. * unittests/basic_string_view/element_access/char/1.cc (test01): Remove unused variable. * windows-nat.c (windows_continue, windows_add_all_dlls) (do_initial_windows_stuff, windows_nat_target::create_inferior): Remove unused variables.
2018-07-08 20:15:04 +02:00
uint32_t reg_src1 = 0;
uint32_t opcode1 = 0;
arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 21, 24);
arm_insn_r->decode = bits (arm_insn_r->arm_insn, 4, 7);
opcode1 = bits (arm_insn_r->arm_insn, 20, 24);
if (!((opcode1 & 0x19) == 0x10))
{
/* Data-processing (register) and Data-processing (register-shifted
register */
/* Out of 11 shifter operands mode, all the insn modifies destination
register, which is specified by 13-16 decode. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
else if ((arm_insn_r->decode < 8) && ((opcode1 & 0x19) == 0x10))
{
/* Miscellaneous instructions */
if (3 == arm_insn_r->decode && 0x12 == opcode1
&& sbo_sbz (arm_insn_r->arm_insn, 9, 12, 1))
{
/* Handle BLX, branch and link/exchange. */
if (9 == arm_insn_r->opcode)
{
/* Branch is chosen by setting T bit of CSPR, bitp[0] of Rm,
and R14 stores the return address. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
}
else if (7 == arm_insn_r->decode && 0x12 == opcode1)
{
/* Handle enhanced software breakpoint insn, BKPT. */
/* CPSR is changed to be executed in ARM state, disabling normal
interrupts, entering abort mode. */
/* According to high vector configuration PC is set. */
/* user hit breakpoint and type reverse, in
that case, we need to go back with previous CPSR and
Program Counter. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
arm_insn_r->reg_rec_count = 2;
/* Save SPSR also; how? */
return -1;
}
else if (1 == arm_insn_r->decode && 0x12 == opcode1
&& sbo_sbz (arm_insn_r->arm_insn, 9, 12, 1))
{
/* Handle BX, branch and link/exchange. */
/* Branch is chosen by setting T bit of CSPR, bitp[0] of Rm. */
record_buf[0] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
else if (1 == arm_insn_r->decode && 0x16 == opcode1
&& sbo_sbz (arm_insn_r->arm_insn, 9, 4, 1)
&& sbo_sbz (arm_insn_r->arm_insn, 17, 4, 1))
{
/* Count leading zeros: CLZ. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
else if (!bit (arm_insn_r->arm_insn, INSN_S_L_BIT_NUM)
&& (8 == arm_insn_r->opcode || 10 == arm_insn_r->opcode)
&& sbo_sbz (arm_insn_r->arm_insn, 17, 4, 1)
&& sbo_sbz (arm_insn_r->arm_insn, 1, 12, 0))
{
/* Handle MRS insn. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
}
else if (9 == arm_insn_r->decode && opcode1 < 0x10)
{
/* Multiply and multiply-accumulate */
/* Handle multiply instructions. */
/* MLA, MUL, SMLAL, SMULL, UMLAL, UMULL. */
if (0 == arm_insn_r->opcode || 1 == arm_insn_r->opcode)
{
/* Handle MLA and MUL. */
record_buf[0] = bits (arm_insn_r->arm_insn, 16, 19);
record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
else if (4 <= arm_insn_r->opcode && 7 >= arm_insn_r->opcode)
{
/* Handle SMLAL, SMULL, UMLAL, UMULL. */
record_buf[0] = bits (arm_insn_r->arm_insn, 16, 19);
record_buf[1] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[2] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 3;
}
}
else if (9 == arm_insn_r->decode && opcode1 > 0x10)
{
/* Synchronization primitives */
/* Handling SWP, SWPB. */
/* These insn, changes register and memory as well. */
/* SWP or SWPB insn. */
reg_src1 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
/* SWP insn ?, swaps word. */
if (8 == arm_insn_r->opcode)
{
record_buf_mem[0] = 4;
}
else
{
/* SWPB insn, swaps only byte. */
record_buf_mem[0] = 1;
}
record_buf_mem[1] = u_regval[0];
arm_insn_r->mem_rec_count = 1;
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
else if (11 == arm_insn_r->decode || 13 == arm_insn_r->decode
|| 15 == arm_insn_r->decode)
{
if ((opcode1 & 0x12) == 2)
{
/* Extra load/store (unprivileged) */
return -1;
}
else
{
/* Extra load/store */
switch (bits (arm_insn_r->arm_insn, 5, 6))
{
case 1:
if ((opcode1 & 0x05) == 0x0 || (opcode1 & 0x05) == 0x4)
{
/* STRH (register), STRH (immediate) */
arm_record_strx (arm_insn_r, &record_buf[0],
&record_buf_mem[0], ARM_RECORD_STRH);
}
else if ((opcode1 & 0x05) == 0x1)
{
/* LDRH (register) */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
if (bit (arm_insn_r->arm_insn, 21))
{
/* Write back to Rn. */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 16, 19);
}
}
else if ((opcode1 & 0x05) == 0x5)
{
/* LDRH (immediate), LDRH (literal) */
int rn = bits (arm_insn_r->arm_insn, 16, 19);
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
if (rn != 15)
{
/*LDRH (immediate) */
if (bit (arm_insn_r->arm_insn, 21))
{
/* Write back to Rn. */
record_buf[arm_insn_r->reg_rec_count++] = rn;
}
}
}
else
return -1;
break;
case 2:
if ((opcode1 & 0x05) == 0x0)
{
/* LDRD (register) */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = record_buf[0] + 1;
arm_insn_r->reg_rec_count = 2;
if (bit (arm_insn_r->arm_insn, 21))
{
/* Write back to Rn. */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 16, 19);
}
}
else if ((opcode1 & 0x05) == 0x1)
{
/* LDRSB (register) */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
if (bit (arm_insn_r->arm_insn, 21))
{
/* Write back to Rn. */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 16, 19);
}
}
else if ((opcode1 & 0x05) == 0x4 || (opcode1 & 0x05) == 0x5)
{
/* LDRD (immediate), LDRD (literal), LDRSB (immediate),
LDRSB (literal) */
int rn = bits (arm_insn_r->arm_insn, 16, 19);
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
if (rn != 15)
{
/*LDRD (immediate), LDRSB (immediate) */
if (bit (arm_insn_r->arm_insn, 21))
{
/* Write back to Rn. */
record_buf[arm_insn_r->reg_rec_count++] = rn;
}
}
}
else
return -1;
break;
case 3:
if ((opcode1 & 0x05) == 0x0)
{
/* STRD (register) */
arm_record_strx (arm_insn_r, &record_buf[0],
&record_buf_mem[0], ARM_RECORD_STRD);
}
else if ((opcode1 & 0x05) == 0x1)
{
/* LDRSH (register) */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
if (bit (arm_insn_r->arm_insn, 21))
{
/* Write back to Rn. */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 16, 19);
}
}
else if ((opcode1 & 0x05) == 0x4)
{
/* STRD (immediate) */
arm_record_strx (arm_insn_r, &record_buf[0],
&record_buf_mem[0], ARM_RECORD_STRD);
}
else if ((opcode1 & 0x05) == 0x5)
{
/* LDRSH (immediate), LDRSH (literal) */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
if (bit (arm_insn_r->arm_insn, 21))
{
/* Write back to Rn. */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 16, 19);
}
}
else
return -1;
break;
default:
return -1;
}
}
}
else
{
return -1;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (arm_insn_r->arm_mems, arm_insn_r->mem_rec_count, record_buf_mem);
return 0;
}
/* Handling opcode 001 insns. */
static int
arm_record_data_proc_imm (insn_decode_record *arm_insn_r)
{
uint32_t record_buf[8], record_buf_mem[8];
arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 21, 24);
arm_insn_r->decode = bits (arm_insn_r->arm_insn, 4, 7);
if ((9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode)
&& 2 == bits (arm_insn_r->arm_insn, 20, 21)
&& sbo_sbz (arm_insn_r->arm_insn, 13, 4, 1)
)
{
/* Handle MSR insn. */
if (9 == arm_insn_r->opcode)
{
/* CSPR is going to be changed. */
record_buf[0] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
else
{
/* SPSR is going to be changed. */
}
}
else if (arm_insn_r->opcode <= 15)
{
/* Normal data processing insns. */
/* Out of 11 shifter operands mode, all the insn modifies destination
register, which is specified by 13-16 decode. */
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
else
{
return -1;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (arm_insn_r->arm_mems, arm_insn_r->mem_rec_count, record_buf_mem);
return 0;
}
ARM process record: median instructions This patch is to support some ARM median instructions in process record. With this patch applied, these fails are fixed: -FAIL: gdb.reverse/break-precsave.exp: run to end of main -FAIL: gdb.reverse/break-precsave.exp: go to end of main forward -FAIL: gdb.reverse/break-precsave.exp: end of record log -FAIL: gdb.reverse/break-reverse.exp: continue to breakpoint: end -FAIL: gdb.reverse/break-reverse.exp: end of record log -FAIL: gdb.reverse/until-precsave.exp: run to end of main -FAIL: gdb.reverse/until-precsave.exp: advance to marker2 -FAIL: gdb.reverse/until-precsave.exp: until func, not called by current frame -FAIL: gdb.reverse/until-precsave.exp: reverse-advance to marker2 -FAIL: gdb.reverse/until-precsave.exp: reverse-finish from marker2 -FAIL: gdb.reverse/until-precsave.exp: reverse-advance to final return of factorial -FAIL: gdb.reverse/until-precsave.exp: reverse-until to entry of factorial -FAIL: gdb.reverse/until-reverse.exp: advance to marker2 -FAIL: gdb.reverse/until-reverse.exp: until func, not called by current frame -FAIL: gdb.reverse/until-reverse.exp: reverse-advance to marker2 -FAIL: gdb.reverse/until-reverse.exp: reverse-finish from marker2 -FAIL: gdb.reverse/until-reverse.exp: reverse-advance to final return of factorial -FAIL: gdb.reverse/until-reverse.exp: reverse-until to entry of factorial gdb: 2016-03-21 Yao Qi <yao.qi@linaro.org> * arm-tdep.c (arm_record_media): New. (arm_record_ld_st_reg_offset): Call arm_record_media.
2016-03-21 11:41:38 +01:00
static int
arm_record_media (insn_decode_record *arm_insn_r)
{
uint32_t record_buf[8];
switch (bits (arm_insn_r->arm_insn, 22, 24))
{
case 0:
/* Parallel addition and subtraction, signed */
case 1:
/* Parallel addition and subtraction, unsigned */
case 2:
case 3:
/* Packing, unpacking, saturation and reversal */
{
int rd = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[arm_insn_r->reg_rec_count++] = rd;
}
break;
case 4:
case 5:
/* Signed multiplies */
{
int rd = bits (arm_insn_r->arm_insn, 16, 19);
unsigned int op1 = bits (arm_insn_r->arm_insn, 20, 22);
record_buf[arm_insn_r->reg_rec_count++] = rd;
if (op1 == 0x0)
record_buf[arm_insn_r->reg_rec_count++] = ARM_PS_REGNUM;
else if (op1 == 0x4)
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 12, 15);
}
break;
case 6:
{
if (bit (arm_insn_r->arm_insn, 21)
&& bits (arm_insn_r->arm_insn, 5, 6) == 0x2)
{
/* SBFX */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 12, 15);
}
else if (bits (arm_insn_r->arm_insn, 20, 21) == 0x0
&& bits (arm_insn_r->arm_insn, 5, 7) == 0x0)
{
/* USAD8 and USADA8 */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 16, 19);
}
}
break;
case 7:
{
if (bits (arm_insn_r->arm_insn, 20, 21) == 0x3
&& bits (arm_insn_r->arm_insn, 5, 7) == 0x7)
{
/* Permanently UNDEFINED */
return -1;
}
else
{
/* BFC, BFI and UBFX */
record_buf[arm_insn_r->reg_rec_count++]
= bits (arm_insn_r->arm_insn, 12, 15);
}
}
break;
default:
return -1;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
return 0;
}
/* Handle ARM mode instructions with opcode 010. */
static int
arm_record_ld_st_imm_offset (insn_decode_record *arm_insn_r)
{
struct regcache *reg_cache = arm_insn_r->regcache;
uint32_t reg_base , reg_dest;
uint32_t offset_12, tgt_mem_addr;
uint32_t record_buf[8], record_buf_mem[8];
unsigned char wback;
ULONGEST u_regval;
/* Calculate wback. */
wback = (bit (arm_insn_r->arm_insn, 24) == 0)
|| (bit (arm_insn_r->arm_insn, 21) == 1);
arm_insn_r->reg_rec_count = 0;
reg_base = bits (arm_insn_r->arm_insn, 16, 19);
if (bit (arm_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
/* LDR (immediate), LDR (literal), LDRB (immediate), LDRB (literal), LDRBT
and LDRT. */
reg_dest = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[arm_insn_r->reg_rec_count++] = reg_dest;
/* The LDR instruction is capable of doing branching. If MOV LR, PC
preceeds a LDR instruction having R15 as reg_base, it
emulates a branch and link instruction, and hence we need to save
CPSR and PC as well. */
if (ARM_PC_REGNUM == reg_dest)
record_buf[arm_insn_r->reg_rec_count++] = ARM_PS_REGNUM;
/* If wback is true, also save the base register, which is going to be
written to. */
if (wback)
record_buf[arm_insn_r->reg_rec_count++] = reg_base;
}
else
{
/* STR (immediate), STRB (immediate), STRBT and STRT. */
offset_12 = bits (arm_insn_r->arm_insn, 0, 11);
regcache_raw_read_unsigned (reg_cache, reg_base, &u_regval);
/* Handle bit U. */
if (bit (arm_insn_r->arm_insn, 23))
{
/* U == 1: Add the offset. */
tgt_mem_addr = (uint32_t) u_regval + offset_12;
}
else
{
/* U == 0: subtract the offset. */
tgt_mem_addr = (uint32_t) u_regval - offset_12;
}
/* Bit 22 tells us whether the store instruction writes 1 byte or 4
bytes. */
if (bit (arm_insn_r->arm_insn, 22))
{
/* STRB and STRBT: 1 byte. */
record_buf_mem[0] = 1;
}
else
{
/* STR and STRT: 4 bytes. */
record_buf_mem[0] = 4;
}
/* Handle bit P. */
if (bit (arm_insn_r->arm_insn, 24))
record_buf_mem[1] = tgt_mem_addr;
else
record_buf_mem[1] = (uint32_t) u_regval;
arm_insn_r->mem_rec_count = 1;
/* If wback is true, also save the base register, which is going to be
written to. */
if (wback)
record_buf[arm_insn_r->reg_rec_count++] = reg_base;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (arm_insn_r->arm_mems, arm_insn_r->mem_rec_count, record_buf_mem);
return 0;
}
/* Handling opcode 011 insns. */
static int
arm_record_ld_st_reg_offset (insn_decode_record *arm_insn_r)
{
struct regcache *reg_cache = arm_insn_r->regcache;
uint32_t shift_imm = 0;
uint32_t reg_src1 = 0, reg_src2 = 0, reg_dest = 0;
uint32_t offset_12 = 0, tgt_mem_addr = 0;
uint32_t record_buf[8], record_buf_mem[8];
LONGEST s_word;
ULONGEST u_regval[2];
ARM process record: median instructions This patch is to support some ARM median instructions in process record. With this patch applied, these fails are fixed: -FAIL: gdb.reverse/break-precsave.exp: run to end of main -FAIL: gdb.reverse/break-precsave.exp: go to end of main forward -FAIL: gdb.reverse/break-precsave.exp: end of record log -FAIL: gdb.reverse/break-reverse.exp: continue to breakpoint: end -FAIL: gdb.reverse/break-reverse.exp: end of record log -FAIL: gdb.reverse/until-precsave.exp: run to end of main -FAIL: gdb.reverse/until-precsave.exp: advance to marker2 -FAIL: gdb.reverse/until-precsave.exp: until func, not called by current frame -FAIL: gdb.reverse/until-precsave.exp: reverse-advance to marker2 -FAIL: gdb.reverse/until-precsave.exp: reverse-finish from marker2 -FAIL: gdb.reverse/until-precsave.exp: reverse-advance to final return of factorial -FAIL: gdb.reverse/until-precsave.exp: reverse-until to entry of factorial -FAIL: gdb.reverse/until-reverse.exp: advance to marker2 -FAIL: gdb.reverse/until-reverse.exp: until func, not called by current frame -FAIL: gdb.reverse/until-reverse.exp: reverse-advance to marker2 -FAIL: gdb.reverse/until-reverse.exp: reverse-finish from marker2 -FAIL: gdb.reverse/until-reverse.exp: reverse-advance to final return of factorial -FAIL: gdb.reverse/until-reverse.exp: reverse-until to entry of factorial gdb: 2016-03-21 Yao Qi <yao.qi@linaro.org> * arm-tdep.c (arm_record_media): New. (arm_record_ld_st_reg_offset): Call arm_record_media.
2016-03-21 11:41:38 +01:00
if (bit (arm_insn_r->arm_insn, 4))
return arm_record_media (arm_insn_r);
arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 21, 24);
arm_insn_r->decode = bits (arm_insn_r->arm_insn, 4, 7);
/* Handle enhanced store insns and LDRD DSP insn,
order begins according to addressing modes for store insns
STRH insn. */
/* LDR or STR? */
if (bit (arm_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
reg_dest = bits (arm_insn_r->arm_insn, 12, 15);
/* LDR insn has a capability to do branching, if
[gdb] Fix more typos in comments Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
MOV LR, PC is preceded by LDR insn having Rn as R15
in that case, it emulates branch and link insn, and hence we
need to save CSPR and PC as well. */
if (15 != reg_dest)
{
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
arm_insn_r->reg_rec_count = 1;
}
else
{
record_buf[0] = reg_dest;
record_buf[1] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 2;
}
}
else
{
if (! bits (arm_insn_r->arm_insn, 4, 11))
{
/* Store insn, register offset and register pre-indexed,
register post-indexed. */
/* Get Rm. */
reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
/* Get Rn. */
reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_src1
, &u_regval[0]);
regcache_raw_read_unsigned (reg_cache, reg_src2
, &u_regval[1]);
if (15 == reg_src2)
{
/* If R15 was used as Rn, hence current PC+8. */
/* Pre-indexed mode doesnt reach here ; illegal insn. */
u_regval[0] = u_regval[0] + 8;
}
/* Calculate target store address, Rn +/- Rm, register offset. */
/* U == 1. */
if (bit (arm_insn_r->arm_insn, 23))
{
tgt_mem_addr = u_regval[0] + u_regval[1];
}
else
{
tgt_mem_addr = u_regval[1] - u_regval[0];
}
switch (arm_insn_r->opcode)
{
/* STR. */
case 8:
case 12:
/* STR. */
case 9:
case 13:
/* STRT. */
case 1:
case 5:
/* STR. */
case 0:
case 4:
record_buf_mem[0] = 4;
break;
/* STRB. */
case 10:
case 14:
/* STRB. */
case 11:
case 15:
/* STRBT. */
case 3:
case 7:
/* STRB. */
case 2:
case 6:
record_buf_mem[0] = 1;
break;
default:
gdb_assert_not_reached ("no decoding pattern found");
break;
}
record_buf_mem[1] = tgt_mem_addr;
arm_insn_r->mem_rec_count = 1;
if (9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode
|| 13 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
|| 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
|| 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
|| 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
|| 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
)
{
/* Rn is going to be changed in pre-indexed mode and
post-indexed mode as well. */
record_buf[0] = reg_src2;
arm_insn_r->reg_rec_count = 1;
}
}
else
{
/* Store insn, scaled register offset; scaled pre-indexed. */
offset_12 = bits (arm_insn_r->arm_insn, 5, 6);
/* Get Rm. */
reg_src1 = bits (arm_insn_r->arm_insn, 0, 3);
/* Get Rn. */
reg_src2 = bits (arm_insn_r->arm_insn, 16, 19);
/* Get shift_imm. */
shift_imm = bits (arm_insn_r->arm_insn, 7, 11);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
regcache_raw_read_signed (reg_cache, reg_src1, &s_word);
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
/* Offset_12 used as shift. */
switch (offset_12)
{
case 0:
/* Offset_12 used as index. */
offset_12 = u_regval[0] << shift_imm;
break;
case 1:
offset_12 = (!shift_imm)?0:u_regval[0] >> shift_imm;
break;
case 2:
if (!shift_imm)
{
if (bit (u_regval[0], 31))
{
offset_12 = 0xFFFFFFFF;
}
else
{
offset_12 = 0;
}
}
else
{
/* This is arithmetic shift. */
offset_12 = s_word >> shift_imm;
}
break;
case 3:
if (!shift_imm)
{
regcache_raw_read_unsigned (reg_cache, ARM_PS_REGNUM,
&u_regval[1]);
/* Get C flag value and shift it by 31. */
offset_12 = (((bit (u_regval[1], 29)) << 31) \
| (u_regval[0]) >> 1);
}
else
{
offset_12 = (u_regval[0] >> shift_imm) \
| (u_regval[0] <<
(sizeof(uint32_t) - shift_imm));
}
break;
default:
gdb_assert_not_reached ("no decoding pattern found");
break;
}
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
/* bit U set. */
if (bit (arm_insn_r->arm_insn, 23))
{
tgt_mem_addr = u_regval[1] + offset_12;
}
else
{
tgt_mem_addr = u_regval[1] - offset_12;
}
switch (arm_insn_r->opcode)
{
/* STR. */
case 8:
case 12:
/* STR. */
case 9:
case 13:
/* STRT. */
case 1:
case 5:
/* STR. */
case 0:
case 4:
record_buf_mem[0] = 4;
break;
/* STRB. */
case 10:
case 14:
/* STRB. */
case 11:
case 15:
/* STRBT. */
case 3:
case 7:
/* STRB. */
case 2:
case 6:
record_buf_mem[0] = 1;
break;
default:
gdb_assert_not_reached ("no decoding pattern found");
break;
}
record_buf_mem[1] = tgt_mem_addr;
arm_insn_r->mem_rec_count = 1;
if (9 == arm_insn_r->opcode || 11 == arm_insn_r->opcode
|| 13 == arm_insn_r->opcode || 15 == arm_insn_r->opcode
|| 0 == arm_insn_r->opcode || 2 == arm_insn_r->opcode
|| 4 == arm_insn_r->opcode || 6 == arm_insn_r->opcode
|| 1 == arm_insn_r->opcode || 3 == arm_insn_r->opcode
|| 5 == arm_insn_r->opcode || 7 == arm_insn_r->opcode
)
{
/* Rn is going to be changed in register scaled pre-indexed
mode,and scaled post indexed mode. */
record_buf[0] = reg_src2;
arm_insn_r->reg_rec_count = 1;
}
}
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (arm_insn_r->arm_mems, arm_insn_r->mem_rec_count, record_buf_mem);
return 0;
}
/* Handle ARM mode instructions with opcode 100. */
static int
arm_record_ld_st_multiple (insn_decode_record *arm_insn_r)
{
struct regcache *reg_cache = arm_insn_r->regcache;
uint32_t register_count = 0, register_bits;
uint32_t reg_base, addr_mode;
uint32_t record_buf[24], record_buf_mem[48];
uint32_t wback;
ULONGEST u_regval;
/* Fetch the list of registers. */
register_bits = bits (arm_insn_r->arm_insn, 0, 15);
arm_insn_r->reg_rec_count = 0;
/* Fetch the base register that contains the address we are loading data
to. */
reg_base = bits (arm_insn_r->arm_insn, 16, 19);
/* Calculate wback. */
wback = (bit (arm_insn_r->arm_insn, 21) == 1);
if (bit (arm_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
/* LDM/LDMIA/LDMFD, LDMDA/LDMFA, LDMDB and LDMIB. */
/* Find out which registers are going to be loaded from memory. */
while (register_bits)
{
if (register_bits & 0x00000001)
record_buf[arm_insn_r->reg_rec_count++] = register_count;
register_bits = register_bits >> 1;
register_count++;
}
/* If wback is true, also save the base register, which is going to be
written to. */
if (wback)
record_buf[arm_insn_r->reg_rec_count++] = reg_base;
/* Save the CPSR register. */
record_buf[arm_insn_r->reg_rec_count++] = ARM_PS_REGNUM;
}
else
{
/* STM (STMIA, STMEA), STMDA (STMED), STMDB (STMFD) and STMIB (STMFA). */
addr_mode = bits (arm_insn_r->arm_insn, 23, 24);
regcache_raw_read_unsigned (reg_cache, reg_base, &u_regval);
/* Find out how many registers are going to be stored to memory. */
while (register_bits)
{
if (register_bits & 0x00000001)
register_count++;
register_bits = register_bits >> 1;
}
switch (addr_mode)
{
/* STMDA (STMED): Decrement after. */
case 0:
record_buf_mem[1] = (uint32_t) u_regval
- register_count * ARM_INT_REGISTER_SIZE + 4;
break;
/* STM (STMIA, STMEA): Increment after. */
case 1:
record_buf_mem[1] = (uint32_t) u_regval;
break;
/* STMDB (STMFD): Decrement before. */
case 2:
record_buf_mem[1] = (uint32_t) u_regval
- register_count * ARM_INT_REGISTER_SIZE;
break;
/* STMIB (STMFA): Increment before. */
case 3:
record_buf_mem[1] = (uint32_t) u_regval + ARM_INT_REGISTER_SIZE;
break;
default:
gdb_assert_not_reached ("no decoding pattern found");
break;
}
record_buf_mem[0] = register_count * ARM_INT_REGISTER_SIZE;
arm_insn_r->mem_rec_count = 1;
/* If wback is true, also save the base register, which is going to be
written to. */
if (wback)
record_buf[arm_insn_r->reg_rec_count++] = reg_base;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (arm_insn_r->arm_mems, arm_insn_r->mem_rec_count, record_buf_mem);
return 0;
}
/* Handling opcode 101 insns. */
static int
arm_record_b_bl (insn_decode_record *arm_insn_r)
{
uint32_t record_buf[8];
/* Handle B, BL, BLX(1) insns. */
/* B simply branches so we do nothing here. */
/* Note: BLX(1) doesnt fall here but instead it falls into
extension space. */
if (bit (arm_insn_r->arm_insn, 24))
{
record_buf[0] = ARM_LR_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
return 0;
}
static int
arm_record_unsupported_insn (insn_decode_record *arm_insn_r)
{
printf_unfiltered (_("Process record does not support instruction "
"0x%0x at address %s.\n"),arm_insn_r->arm_insn,
paddress (arm_insn_r->gdbarch, arm_insn_r->this_addr));
return -1;
}
/* Record handler for vector data transfer instructions. */
static int
arm_record_vdata_transfer_insn (insn_decode_record *arm_insn_r)
{
uint32_t bits_a, bit_c, bit_l, reg_t, reg_v;
uint32_t record_buf[4];
reg_t = bits (arm_insn_r->arm_insn, 12, 15);
reg_v = bits (arm_insn_r->arm_insn, 21, 23);
bits_a = bits (arm_insn_r->arm_insn, 21, 23);
bit_l = bit (arm_insn_r->arm_insn, 20);
bit_c = bit (arm_insn_r->arm_insn, 8);
/* Handle VMOV instruction. */
if (bit_l && bit_c)
{
record_buf[0] = reg_t;
arm_insn_r->reg_rec_count = 1;
}
else if (bit_l && !bit_c)
{
/* Handle VMOV instruction. */
if (bits_a == 0x00)
{
record_buf[0] = reg_t;
arm_insn_r->reg_rec_count = 1;
}
/* Handle VMRS instruction. */
else if (bits_a == 0x07)
{
if (reg_t == 15)
reg_t = ARM_PS_REGNUM;
record_buf[0] = reg_t;
arm_insn_r->reg_rec_count = 1;
}
}
else if (!bit_l && !bit_c)
{
/* Handle VMOV instruction. */
if (bits_a == 0x00)
{
record_buf[0] = ARM_D0_REGNUM + reg_v;
arm_insn_r->reg_rec_count = 1;
}
/* Handle VMSR instruction. */
else if (bits_a == 0x07)
{
record_buf[0] = ARM_FPSCR_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
}
else if (!bit_l && bit_c)
{
/* Handle VMOV instruction. */
if (!(bits_a & 0x04))
{
record_buf[0] = (reg_v | (bit (arm_insn_r->arm_insn, 7) << 4))
+ ARM_D0_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
/* Handle VDUP instruction. */
else
{
if (bit (arm_insn_r->arm_insn, 21))
{
reg_v = reg_v | (bit (arm_insn_r->arm_insn, 7) << 4);
record_buf[0] = reg_v + ARM_D0_REGNUM;
record_buf[1] = reg_v + ARM_D0_REGNUM + 1;
arm_insn_r->reg_rec_count = 2;
}
else
{
reg_v = reg_v | (bit (arm_insn_r->arm_insn, 7) << 4);
record_buf[0] = reg_v + ARM_D0_REGNUM;
arm_insn_r->reg_rec_count = 1;
}
}
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
return 0;
}
/* Record handler for extension register load/store instructions. */
static int
arm_record_exreg_ld_st_insn (insn_decode_record *arm_insn_r)
{
uint32_t opcode, single_reg;
uint8_t op_vldm_vstm;
uint32_t record_buf[8], record_buf_mem[128];
ULONGEST u_regval = 0;
struct regcache *reg_cache = arm_insn_r->regcache;
opcode = bits (arm_insn_r->arm_insn, 20, 24);
single_reg = !bit (arm_insn_r->arm_insn, 8);
op_vldm_vstm = opcode & 0x1b;
/* Handle VMOV instructions. */
if ((opcode & 0x1e) == 0x04)
{
if (bit (arm_insn_r->arm_insn, 20)) /* to_arm_registers bit 20? */
{
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
record_buf[1] = bits (arm_insn_r->arm_insn, 16, 19);
arm_insn_r->reg_rec_count = 2;
}
else
{
uint8_t reg_m = bits (arm_insn_r->arm_insn, 0, 3);
uint8_t bit_m = bit (arm_insn_r->arm_insn, 5);
if (single_reg)
{
/* The first S register number m is REG_M:M (M is bit 5),
the corresponding D register number is REG_M:M / 2, which
is REG_M. */
record_buf[arm_insn_r->reg_rec_count++] = ARM_D0_REGNUM + reg_m;
/* The second S register number is REG_M:M + 1, the
corresponding D register number is (REG_M:M + 1) / 2.
IOW, if bit M is 1, the first and second S registers
are mapped to different D registers, otherwise, they are
in the same D register. */
if (bit_m)
{
record_buf[arm_insn_r->reg_rec_count++]
= ARM_D0_REGNUM + reg_m + 1;
}
}
else
{
record_buf[0] = ((bit_m << 4) + reg_m + ARM_D0_REGNUM);
arm_insn_r->reg_rec_count = 1;
}
}
}
/* Handle VSTM and VPUSH instructions. */
else if (op_vldm_vstm == 0x08 || op_vldm_vstm == 0x0a
|| op_vldm_vstm == 0x12)
{
uint32_t start_address, reg_rn, imm_off32, imm_off8, memory_count;
uint32_t memory_index = 0;
reg_rn = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval);
imm_off8 = bits (arm_insn_r->arm_insn, 0, 7);
imm_off32 = imm_off8 << 2;
memory_count = imm_off8;
if (bit (arm_insn_r->arm_insn, 23))
start_address = u_regval;
else
start_address = u_regval - imm_off32;
if (bit (arm_insn_r->arm_insn, 21))
{
record_buf[0] = reg_rn;
arm_insn_r->reg_rec_count = 1;
}
while (memory_count > 0)
{
if (single_reg)
{
record_buf_mem[memory_index] = 4;
record_buf_mem[memory_index + 1] = start_address;
start_address = start_address + 4;
memory_index = memory_index + 2;
}
else
{
record_buf_mem[memory_index] = 4;
record_buf_mem[memory_index + 1] = start_address;
record_buf_mem[memory_index + 2] = 4;
record_buf_mem[memory_index + 3] = start_address + 4;
start_address = start_address + 8;
memory_index = memory_index + 4;
}
memory_count--;
}
arm_insn_r->mem_rec_count = (memory_index >> 1);
}
/* Handle VLDM instructions. */
else if (op_vldm_vstm == 0x09 || op_vldm_vstm == 0x0b
|| op_vldm_vstm == 0x13)
{
uint32_t reg_count, reg_vd;
uint32_t reg_index = 0;
uint32_t bit_d = bit (arm_insn_r->arm_insn, 22);
reg_vd = bits (arm_insn_r->arm_insn, 12, 15);
reg_count = bits (arm_insn_r->arm_insn, 0, 7);
/* REG_VD is the first D register number. If the instruction
loads memory to S registers (SINGLE_REG is TRUE), the register
number is (REG_VD << 1 | bit D), so the corresponding D
register number is (REG_VD << 1 | bit D) / 2 = REG_VD. */
if (!single_reg)
reg_vd = reg_vd | (bit_d << 4);
if (bit (arm_insn_r->arm_insn, 21) /* write back */)
record_buf[reg_index++] = bits (arm_insn_r->arm_insn, 16, 19);
/* If the instruction loads memory to D register, REG_COUNT should
be divided by 2, according to the ARM Architecture Reference
Manual. If the instruction loads memory to S register, divide by
2 as well because two S registers are mapped to D register. */
reg_count = reg_count / 2;
if (single_reg && bit_d)
{
/* Increase the register count if S register list starts from
an odd number (bit d is one). */
reg_count++;
}
while (reg_count > 0)
{
record_buf[reg_index++] = ARM_D0_REGNUM + reg_vd + reg_count - 1;
reg_count--;
}
arm_insn_r->reg_rec_count = reg_index;
}
/* VSTR Vector store register. */
else if ((opcode & 0x13) == 0x10)
{
uint32_t start_address, reg_rn, imm_off32, imm_off8;
uint32_t memory_index = 0;
reg_rn = bits (arm_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval);
imm_off8 = bits (arm_insn_r->arm_insn, 0, 7);
imm_off32 = imm_off8 << 2;
if (bit (arm_insn_r->arm_insn, 23))
start_address = u_regval + imm_off32;
else
start_address = u_regval - imm_off32;
if (single_reg)
{
record_buf_mem[memory_index] = 4;
record_buf_mem[memory_index + 1] = start_address;
arm_insn_r->mem_rec_count = 1;
}
else
{
record_buf_mem[memory_index] = 4;
record_buf_mem[memory_index + 1] = start_address;
record_buf_mem[memory_index + 2] = 4;
record_buf_mem[memory_index + 3] = start_address + 4;
arm_insn_r->mem_rec_count = 2;
}
}
/* VLDR Vector load register. */
else if ((opcode & 0x13) == 0x11)
{
uint32_t reg_vd = bits (arm_insn_r->arm_insn, 12, 15);
if (!single_reg)
{
reg_vd = reg_vd | (bit (arm_insn_r->arm_insn, 22) << 4);
record_buf[0] = ARM_D0_REGNUM + reg_vd;
}
else
{
reg_vd = (reg_vd << 1) | bit (arm_insn_r->arm_insn, 22);
/* Record register D rather than pseudo register S. */
record_buf[0] = ARM_D0_REGNUM + reg_vd / 2;
}
arm_insn_r->reg_rec_count = 1;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (arm_insn_r->arm_mems, arm_insn_r->mem_rec_count, record_buf_mem);
return 0;
}
/* Record handler for arm/thumb mode VFP data processing instructions. */
static int
arm_record_vfp_data_proc_insn (insn_decode_record *arm_insn_r)
{
uint32_t opc1, opc2, opc3, dp_op_sz, bit_d, reg_vd;
uint32_t record_buf[4];
enum insn_types {INSN_T0, INSN_T1, INSN_T2, INSN_T3, INSN_INV};
enum insn_types curr_insn_type = INSN_INV;
reg_vd = bits (arm_insn_r->arm_insn, 12, 15);
opc1 = bits (arm_insn_r->arm_insn, 20, 23);
opc2 = bits (arm_insn_r->arm_insn, 16, 19);
opc3 = bits (arm_insn_r->arm_insn, 6, 7);
dp_op_sz = bit (arm_insn_r->arm_insn, 8);
bit_d = bit (arm_insn_r->arm_insn, 22);
/* Mask off the "D" bit. */
opc1 = opc1 & ~0x04;
/* Handle VMLA, VMLS. */
if (opc1 == 0x00)
{
if (bit (arm_insn_r->arm_insn, 10))
{
if (bit (arm_insn_r->arm_insn, 6))
curr_insn_type = INSN_T0;
else
curr_insn_type = INSN_T1;
}
else
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
}
/* Handle VNMLA, VNMLS, VNMUL. */
else if (opc1 == 0x01)
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
/* Handle VMUL. */
else if (opc1 == 0x02 && !(opc3 & 0x01))
{
if (bit (arm_insn_r->arm_insn, 10))
{
if (bit (arm_insn_r->arm_insn, 6))
curr_insn_type = INSN_T0;
else
curr_insn_type = INSN_T1;
}
else
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
}
/* Handle VADD, VSUB. */
else if (opc1 == 0x03)
{
if (!bit (arm_insn_r->arm_insn, 9))
{
if (bit (arm_insn_r->arm_insn, 6))
curr_insn_type = INSN_T0;
else
curr_insn_type = INSN_T1;
}
else
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
}
/* Handle VDIV. */
else if (opc1 == 0x08)
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
/* Handle all other vfp data processing instructions. */
else if (opc1 == 0x0b)
{
/* Handle VMOV. */
if (!(opc3 & 0x01) || (opc2 == 0x00 && opc3 == 0x01))
{
if (bit (arm_insn_r->arm_insn, 4))
{
if (bit (arm_insn_r->arm_insn, 6))
curr_insn_type = INSN_T0;
else
curr_insn_type = INSN_T1;
}
else
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
}
/* Handle VNEG and VABS. */
else if ((opc2 == 0x01 && opc3 == 0x01)
|| (opc2 == 0x00 && opc3 == 0x03))
{
if (!bit (arm_insn_r->arm_insn, 11))
{
if (bit (arm_insn_r->arm_insn, 6))
curr_insn_type = INSN_T0;
else
curr_insn_type = INSN_T1;
}
else
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
}
/* Handle VSQRT. */
else if (opc2 == 0x01 && opc3 == 0x03)
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
/* Handle VCVT. */
else if (opc2 == 0x07 && opc3 == 0x03)
{
if (!dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
else if (opc3 & 0x01)
{
/* Handle VCVT. */
if ((opc2 == 0x08) || (opc2 & 0x0e) == 0x0c)
{
if (!bit (arm_insn_r->arm_insn, 18))
curr_insn_type = INSN_T2;
else
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
}
/* Handle VCVT. */
else if ((opc2 & 0x0e) == 0x0a || (opc2 & 0x0e) == 0x0e)
{
if (dp_op_sz)
curr_insn_type = INSN_T1;
else
curr_insn_type = INSN_T2;
}
/* Handle VCVTB, VCVTT. */
else if ((opc2 & 0x0e) == 0x02)
curr_insn_type = INSN_T2;
/* Handle VCMP, VCMPE. */
else if ((opc2 & 0x0e) == 0x04)
curr_insn_type = INSN_T3;
}
}
switch (curr_insn_type)
{
case INSN_T0:
reg_vd = reg_vd | (bit_d << 4);
record_buf[0] = reg_vd + ARM_D0_REGNUM;
record_buf[1] = reg_vd + ARM_D0_REGNUM + 1;
arm_insn_r->reg_rec_count = 2;
break;
case INSN_T1:
reg_vd = reg_vd | (bit_d << 4);
record_buf[0] = reg_vd + ARM_D0_REGNUM;
arm_insn_r->reg_rec_count = 1;
break;
case INSN_T2:
reg_vd = (reg_vd << 1) | bit_d;
record_buf[0] = reg_vd + ARM_D0_REGNUM;
arm_insn_r->reg_rec_count = 1;
break;
case INSN_T3:
record_buf[0] = ARM_FPSCR_REGNUM;
arm_insn_r->reg_rec_count = 1;
break;
default:
gdb_assert_not_reached ("no decoding pattern found");
break;
}
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, record_buf);
return 0;
}
/* Handling opcode 110 insns. */
static int
arm_record_asimd_vfp_coproc (insn_decode_record *arm_insn_r)
{
uint32_t op1, op1_ebit, coproc;
coproc = bits (arm_insn_r->arm_insn, 8, 11);
op1 = bits (arm_insn_r->arm_insn, 20, 25);
op1_ebit = bit (arm_insn_r->arm_insn, 20);
if ((coproc & 0x0e) == 0x0a)
{
/* Handle extension register ld/st instructions. */
if (!(op1 & 0x20))
return arm_record_exreg_ld_st_insn (arm_insn_r);
/* 64-bit transfers between arm core and extension registers. */
if ((op1 & 0x3e) == 0x04)
return arm_record_exreg_ld_st_insn (arm_insn_r);
}
else
{
/* Handle coprocessor ld/st instructions. */
if (!(op1 & 0x3a))
{
/* Store. */
if (!op1_ebit)
return arm_record_unsupported_insn (arm_insn_r);
else
/* Load. */
return arm_record_unsupported_insn (arm_insn_r);
}
/* Move to coprocessor from two arm core registers. */
if (op1 == 0x4)
return arm_record_unsupported_insn (arm_insn_r);
/* Move to two arm core registers from coprocessor. */
if (op1 == 0x5)
{
uint32_t reg_t[2];
reg_t[0] = bits (arm_insn_r->arm_insn, 12, 15);
reg_t[1] = bits (arm_insn_r->arm_insn, 16, 19);
arm_insn_r->reg_rec_count = 2;
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count, reg_t);
return 0;
}
}
return arm_record_unsupported_insn (arm_insn_r);
}
/* Handling opcode 111 insns. */
static int
arm_record_coproc_data_proc (insn_decode_record *arm_insn_r)
{
uint32_t op, op1_ebit, coproc, bits_24_25;
struct gdbarch_tdep *tdep = gdbarch_tdep (arm_insn_r->gdbarch);
struct regcache *reg_cache = arm_insn_r->regcache;
arm_insn_r->opcode = bits (arm_insn_r->arm_insn, 24, 27);
coproc = bits (arm_insn_r->arm_insn, 8, 11);
op1_ebit = bit (arm_insn_r->arm_insn, 20);
op = bit (arm_insn_r->arm_insn, 4);
bits_24_25 = bits (arm_insn_r->arm_insn, 24, 25);
/* Handle arm SWI/SVC system call instructions. */
if (bits_24_25 == 0x3)
{
if (tdep->arm_syscall_record != NULL)
{
ULONGEST svc_operand, svc_number;
svc_operand = (0x00ffffff & arm_insn_r->arm_insn);
if (svc_operand) /* OABI. */
svc_number = svc_operand - 0x900000;
else /* EABI. */
regcache_raw_read_unsigned (reg_cache, 7, &svc_number);
return tdep->arm_syscall_record (reg_cache, svc_number);
}
else
{
printf_unfiltered (_("no syscall record support\n"));
return -1;
}
}
else if (bits_24_25 == 0x02)
{
if (op)
{
if ((coproc & 0x0e) == 0x0a)
{
/* 8, 16, and 32-bit transfer */
return arm_record_vdata_transfer_insn (arm_insn_r);
}
else
{
if (op1_ebit)
{
/* MRC, MRC2 */
uint32_t record_buf[1];
record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15);
if (record_buf[0] == 15)
record_buf[0] = ARM_PS_REGNUM;
arm_insn_r->reg_rec_count = 1;
REG_ALLOC (arm_insn_r->arm_regs, arm_insn_r->reg_rec_count,
record_buf);
return 0;
}
else
{
/* MCR, MCR2 */
return -1;
}
}
}
else
{
if ((coproc & 0x0e) == 0x0a)
{
/* VFP data-processing instructions. */
return arm_record_vfp_data_proc_insn (arm_insn_r);
}
else
{
/* CDP, CDP2 */
return -1;
}
}
}
else
{
unsigned int op1 = bits (arm_insn_r->arm_insn, 20, 25);
if (op1 == 5)
{
if ((coproc & 0x0e) != 0x0a)
{
/* MRRC, MRRC2 */
return -1;
}
}
else if (op1 == 4 || op1 == 5)
{
if ((coproc & 0x0e) == 0x0a)
{
/* 64-bit transfers between ARM core and extension */
return -1;
}
else if (op1 == 4)
{
/* MCRR, MCRR2 */
return -1;
}
}
else if (op1 == 0 || op1 == 1)
{
/* UNDEFINED */
return -1;
}
else
{
if ((coproc & 0x0e) == 0x0a)
{
/* Extension register load/store */
}
else
{
/* STC, STC2, LDC, LDC2 */
}
return -1;
}
}
return -1;
}
/* Handling opcode 000 insns. */
static int
thumb_record_shift_add_sub (insn_decode_record *thumb_insn_r)
{
uint32_t record_buf[8];
uint32_t reg_src1 = 0;
reg_src1 = bits (thumb_insn_r->arm_insn, 0, 2);
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = reg_src1;
thumb_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
return 0;
}
/* Handling opcode 001 insns. */
static int
thumb_record_add_sub_cmp_mov (insn_decode_record *thumb_insn_r)
{
uint32_t record_buf[8];
uint32_t reg_src1 = 0;
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = reg_src1;
thumb_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
return 0;
}
/* Handling opcode 010 insns. */
static int
thumb_record_ld_st_reg_offset (insn_decode_record *thumb_insn_r)
{
struct regcache *reg_cache = thumb_insn_r->regcache;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t reg_src1 = 0, reg_src2 = 0;
uint32_t opcode1 = 0, opcode2 = 0, opcode3 = 0;
ULONGEST u_regval[2] = {0};
opcode1 = bits (thumb_insn_r->arm_insn, 10, 12);
if (bit (thumb_insn_r->arm_insn, 12))
{
/* Handle load/store register offset. */
uint32_t opB = bits (thumb_insn_r->arm_insn, 9, 11);
if (in_inclusive_range (opB, 4U, 7U))
{
/* LDR(2), LDRB(2) , LDRH(2), LDRSB, LDRSH. */
reg_src1 = bits (thumb_insn_r->arm_insn,0, 2);
record_buf[0] = reg_src1;
thumb_insn_r->reg_rec_count = 1;
}
else if (in_inclusive_range (opB, 0U, 2U))
{
/* STR(2), STRB(2), STRH(2) . */
reg_src1 = bits (thumb_insn_r->arm_insn, 3, 5);
reg_src2 = bits (thumb_insn_r->arm_insn, 6, 8);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval[0]);
regcache_raw_read_unsigned (reg_cache, reg_src2, &u_regval[1]);
if (0 == opB)
record_buf_mem[0] = 4; /* STR (2). */
else if (2 == opB)
record_buf_mem[0] = 1; /* STRB (2). */
else if (1 == opB)
record_buf_mem[0] = 2; /* STRH (2). */
record_buf_mem[1] = u_regval[0] + u_regval[1];
thumb_insn_r->mem_rec_count = 1;
}
}
else if (bit (thumb_insn_r->arm_insn, 11))
{
/* Handle load from literal pool. */
/* LDR(3). */
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
record_buf[0] = reg_src1;
thumb_insn_r->reg_rec_count = 1;
}
else if (opcode1)
{
/* Special data instructions and branch and exchange */
opcode2 = bits (thumb_insn_r->arm_insn, 8, 9);
opcode3 = bits (thumb_insn_r->arm_insn, 0, 2);
if ((3 == opcode2) && (!opcode3))
{
/* Branch with exchange. */
record_buf[0] = ARM_PS_REGNUM;
thumb_insn_r->reg_rec_count = 1;
}
else
{
/* Format 8; special data processing insns. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = (bit (thumb_insn_r->arm_insn, 7) << 3
| bits (thumb_insn_r->arm_insn, 0, 2));
thumb_insn_r->reg_rec_count = 2;
}
}
else
{
/* Format 5; data processing insns. */
reg_src1 = bits (thumb_insn_r->arm_insn, 0, 2);
if (bit (thumb_insn_r->arm_insn, 7))
{
reg_src1 = reg_src1 + 8;
}
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = reg_src1;
thumb_insn_r->reg_rec_count = 2;
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
record_buf_mem);
return 0;
}
/* Handling opcode 001 insns. */
static int
thumb_record_ld_st_imm_offset (insn_decode_record *thumb_insn_r)
{
struct regcache *reg_cache = thumb_insn_r->regcache;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t reg_src1 = 0;
uint32_t opcode = 0, immed_5 = 0;
ULONGEST u_regval = 0;
opcode = bits (thumb_insn_r->arm_insn, 11, 12);
if (opcode)
{
/* LDR(1). */
reg_src1 = bits (thumb_insn_r->arm_insn, 0, 2);
record_buf[0] = reg_src1;
thumb_insn_r->reg_rec_count = 1;
}
else
{
/* STR(1). */
reg_src1 = bits (thumb_insn_r->arm_insn, 3, 5);
immed_5 = bits (thumb_insn_r->arm_insn, 6, 10);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval);
record_buf_mem[0] = 4;
record_buf_mem[1] = u_regval + (immed_5 * 4);
thumb_insn_r->mem_rec_count = 1;
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
record_buf_mem);
return 0;
}
/* Handling opcode 100 insns. */
static int
thumb_record_ld_st_stack (insn_decode_record *thumb_insn_r)
{
struct regcache *reg_cache = thumb_insn_r->regcache;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t reg_src1 = 0;
uint32_t opcode = 0, immed_8 = 0, immed_5 = 0;
ULONGEST u_regval = 0;
opcode = bits (thumb_insn_r->arm_insn, 11, 12);
if (3 == opcode)
{
/* LDR(4). */
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
record_buf[0] = reg_src1;
thumb_insn_r->reg_rec_count = 1;
}
else if (1 == opcode)
{
/* LDRH(1). */
reg_src1 = bits (thumb_insn_r->arm_insn, 0, 2);
record_buf[0] = reg_src1;
thumb_insn_r->reg_rec_count = 1;
}
else if (2 == opcode)
{
/* STR(3). */
immed_8 = bits (thumb_insn_r->arm_insn, 0, 7);
regcache_raw_read_unsigned (reg_cache, ARM_SP_REGNUM, &u_regval);
record_buf_mem[0] = 4;
record_buf_mem[1] = u_regval + (immed_8 * 4);
thumb_insn_r->mem_rec_count = 1;
}
else if (0 == opcode)
{
/* STRH(1). */
immed_5 = bits (thumb_insn_r->arm_insn, 6, 10);
reg_src1 = bits (thumb_insn_r->arm_insn, 3, 5);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval);
record_buf_mem[0] = 2;
record_buf_mem[1] = u_regval + (immed_5 * 2);
thumb_insn_r->mem_rec_count = 1;
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
record_buf_mem);
return 0;
}
/* Handling opcode 101 insns. */
static int
thumb_record_misc (insn_decode_record *thumb_insn_r)
{
struct regcache *reg_cache = thumb_insn_r->regcache;
uint32_t opcode = 0;
uint32_t register_bits = 0, register_count = 0;
uint32_t index = 0, start_address = 0;
uint32_t record_buf[24], record_buf_mem[48];
uint32_t reg_src1;
ULONGEST u_regval = 0;
opcode = bits (thumb_insn_r->arm_insn, 11, 12);
if (opcode == 0 || opcode == 1)
{
/* ADR and ADD (SP plus immediate) */
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
record_buf[0] = reg_src1;
thumb_insn_r->reg_rec_count = 1;
}
else
{
/* Miscellaneous 16-bit instructions */
uint32_t opcode2 = bits (thumb_insn_r->arm_insn, 8, 11);
switch (opcode2)
{
case 6:
/* SETEND and CPS */
break;
case 0:
/* ADD/SUB (SP plus immediate) */
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
record_buf[0] = ARM_SP_REGNUM;
thumb_insn_r->reg_rec_count = 1;
break;
case 1: /* fall through */
case 3: /* fall through */
case 9: /* fall through */
case 11:
/* CBNZ, CBZ */
break;
case 2:
/* SXTH, SXTB, UXTH, UXTB */
record_buf[0] = bits (thumb_insn_r->arm_insn, 0, 2);
thumb_insn_r->reg_rec_count = 1;
break;
case 4: /* fall through */
case 5:
/* PUSH. */
register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
regcache_raw_read_unsigned (reg_cache, ARM_SP_REGNUM, &u_regval);
while (register_bits)
{
if (register_bits & 0x00000001)
register_count++;
register_bits = register_bits >> 1;
}
start_address = u_regval - \
(4 * (bit (thumb_insn_r->arm_insn, 8) + register_count));
thumb_insn_r->mem_rec_count = register_count;
while (register_count)
{
record_buf_mem[(register_count * 2) - 1] = start_address;
record_buf_mem[(register_count * 2) - 2] = 4;
start_address = start_address + 4;
register_count--;
}
record_buf[0] = ARM_SP_REGNUM;
thumb_insn_r->reg_rec_count = 1;
break;
case 10:
/* REV, REV16, REVSH */
record_buf[0] = bits (thumb_insn_r->arm_insn, 0, 2);
thumb_insn_r->reg_rec_count = 1;
break;
case 12: /* fall through */
case 13:
/* POP. */
register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
while (register_bits)
{
if (register_bits & 0x00000001)
record_buf[index++] = register_count;
register_bits = register_bits >> 1;
register_count++;
}
record_buf[index++] = ARM_PS_REGNUM;
record_buf[index++] = ARM_SP_REGNUM;
thumb_insn_r->reg_rec_count = index;
break;
case 0xe:
/* BKPT insn. */
/* Handle enhanced software breakpoint insn, BKPT. */
/* CPSR is changed to be executed in ARM state, disabling normal
interrupts, entering abort mode. */
/* According to high vector configuration PC is set. */
/* User hits breakpoint and type reverse, in that case, we need to go back with
previous CPSR and Program Counter. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
thumb_insn_r->reg_rec_count = 2;
/* We need to save SPSR value, which is not yet done. */
printf_unfiltered (_("Process record does not support instruction "
"0x%0x at address %s.\n"),
thumb_insn_r->arm_insn,
paddress (thumb_insn_r->gdbarch,
thumb_insn_r->this_addr));
return -1;
case 0xf:
/* If-Then, and hints */
break;
default:
return -1;
};
}
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
record_buf_mem);
return 0;
}
/* Handling opcode 110 insns. */
static int
thumb_record_ldm_stm_swi (insn_decode_record *thumb_insn_r)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (thumb_insn_r->gdbarch);
struct regcache *reg_cache = thumb_insn_r->regcache;
uint32_t ret = 0; /* function return value: -1:record failure ; 0:success */
uint32_t reg_src1 = 0;
uint32_t opcode1 = 0, opcode2 = 0, register_bits = 0, register_count = 0;
uint32_t index = 0, start_address = 0;
uint32_t record_buf[24], record_buf_mem[48];
ULONGEST u_regval = 0;
opcode1 = bits (thumb_insn_r->arm_insn, 8, 12);
opcode2 = bits (thumb_insn_r->arm_insn, 11, 12);
if (1 == opcode2)
{
/* LDMIA. */
register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
/* Get Rn. */
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
while (register_bits)
{
if (register_bits & 0x00000001)
record_buf[index++] = register_count;
register_bits = register_bits >> 1;
register_count++;
}
record_buf[index++] = reg_src1;
thumb_insn_r->reg_rec_count = index;
}
else if (0 == opcode2)
{
/* It handles both STMIA. */
register_bits = bits (thumb_insn_r->arm_insn, 0, 7);
/* Get Rn. */
reg_src1 = bits (thumb_insn_r->arm_insn, 8, 10);
regcache_raw_read_unsigned (reg_cache, reg_src1, &u_regval);
while (register_bits)
{
if (register_bits & 0x00000001)
register_count++;
register_bits = register_bits >> 1;
}
start_address = u_regval;
thumb_insn_r->mem_rec_count = register_count;
while (register_count)
{
record_buf_mem[(register_count * 2) - 1] = start_address;
record_buf_mem[(register_count * 2) - 2] = 4;
start_address = start_address + 4;
register_count--;
}
}
else if (0x1F == opcode1)
{
/* Handle arm syscall insn. */
if (tdep->arm_syscall_record != NULL)
{
regcache_raw_read_unsigned (reg_cache, 7, &u_regval);
ret = tdep->arm_syscall_record (reg_cache, u_regval);
}
else
{
printf_unfiltered (_("no syscall record support\n"));
return -1;
}
}
/* B (1), conditional branch is automatically taken care in process_record,
as PC is saved there. */
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
MEM_ALLOC (thumb_insn_r->arm_mems, thumb_insn_r->mem_rec_count,
record_buf_mem);
return ret;
}
/* Handling opcode 111 insns. */
static int
thumb_record_branch (insn_decode_record *thumb_insn_r)
{
uint32_t record_buf[8];
uint32_t bits_h = 0;
bits_h = bits (thumb_insn_r->arm_insn, 11, 12);
if (2 == bits_h || 3 == bits_h)
{
/* BL */
record_buf[0] = ARM_LR_REGNUM;
thumb_insn_r->reg_rec_count = 1;
}
else if (1 == bits_h)
{
/* BLX(1). */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
thumb_insn_r->reg_rec_count = 2;
}
/* B(2) is automatically taken care in process_record, as PC is
saved there. */
REG_ALLOC (thumb_insn_r->arm_regs, thumb_insn_r->reg_rec_count, record_buf);
return 0;
}
/* Handler for thumb2 load/store multiple instructions. */
static int
thumb2_record_ld_st_multiple (insn_decode_record *thumb2_insn_r)
{
struct regcache *reg_cache = thumb2_insn_r->regcache;
uint32_t reg_rn, op;
uint32_t register_bits = 0, register_count = 0;
uint32_t index = 0, start_address = 0;
uint32_t record_buf[24], record_buf_mem[48];
ULONGEST u_regval = 0;
reg_rn = bits (thumb2_insn_r->arm_insn, 16, 19);
op = bits (thumb2_insn_r->arm_insn, 23, 24);
if (0 == op || 3 == op)
{
if (bit (thumb2_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
/* Handle RFE instruction. */
record_buf[0] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 1;
}
else
{
/* Handle SRS instruction after reading banked SP. */
return arm_record_unsupported_insn (thumb2_insn_r);
}
}
else if (1 == op || 2 == op)
{
if (bit (thumb2_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
/* Handle LDM/LDMIA/LDMFD and LDMDB/LDMEA instructions. */
register_bits = bits (thumb2_insn_r->arm_insn, 0, 15);
while (register_bits)
{
if (register_bits & 0x00000001)
record_buf[index++] = register_count;
register_count++;
register_bits = register_bits >> 1;
}
record_buf[index++] = reg_rn;
record_buf[index++] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = index;
}
else
{
/* Handle STM/STMIA/STMEA and STMDB/STMFD. */
register_bits = bits (thumb2_insn_r->arm_insn, 0, 15);
regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval);
while (register_bits)
{
if (register_bits & 0x00000001)
register_count++;
register_bits = register_bits >> 1;
}
if (1 == op)
{
/* Start address calculation for LDMDB/LDMEA. */
start_address = u_regval;
}
else if (2 == op)
{
/* Start address calculation for LDMDB/LDMEA. */
start_address = u_regval - register_count * 4;
}
thumb2_insn_r->mem_rec_count = register_count;
while (register_count)
{
record_buf_mem[register_count * 2 - 1] = start_address;
record_buf_mem[register_count * 2 - 2] = 4;
start_address = start_address + 4;
register_count--;
}
record_buf[0] = reg_rn;
record_buf[1] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 2;
}
}
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
record_buf_mem);
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
return ARM_RECORD_SUCCESS;
}
/* Handler for thumb2 load/store (dual/exclusive) and table branch
instructions. */
static int
thumb2_record_ld_st_dual_ex_tbb (insn_decode_record *thumb2_insn_r)
{
struct regcache *reg_cache = thumb2_insn_r->regcache;
uint32_t reg_rd, reg_rn, offset_imm;
uint32_t reg_dest1, reg_dest2;
uint32_t address, offset_addr;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t op1, op2, op3;
ULONGEST u_regval[2];
op1 = bits (thumb2_insn_r->arm_insn, 23, 24);
op2 = bits (thumb2_insn_r->arm_insn, 20, 21);
op3 = bits (thumb2_insn_r->arm_insn, 4, 7);
if (bit (thumb2_insn_r->arm_insn, INSN_S_L_BIT_NUM))
{
if(!(1 == op1 && 1 == op2 && (0 == op3 || 1 == op3)))
{
reg_dest1 = bits (thumb2_insn_r->arm_insn, 12, 15);
record_buf[0] = reg_dest1;
record_buf[1] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 2;
}
if (3 == op2 || (op1 & 2) || (1 == op1 && 1 == op2 && 7 == op3))
{
reg_dest2 = bits (thumb2_insn_r->arm_insn, 8, 11);
record_buf[2] = reg_dest2;
thumb2_insn_r->reg_rec_count = 3;
}
}
else
{
reg_rn = bits (thumb2_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval[0]);
if (0 == op1 && 0 == op2)
{
/* Handle STREX. */
offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
address = u_regval[0] + (offset_imm * 4);
record_buf_mem[0] = 4;
record_buf_mem[1] = address;
thumb2_insn_r->mem_rec_count = 1;
reg_rd = bits (thumb2_insn_r->arm_insn, 0, 3);
record_buf[0] = reg_rd;
thumb2_insn_r->reg_rec_count = 1;
}
else if (1 == op1 && 0 == op2)
{
reg_rd = bits (thumb2_insn_r->arm_insn, 0, 3);
record_buf[0] = reg_rd;
thumb2_insn_r->reg_rec_count = 1;
address = u_regval[0];
record_buf_mem[1] = address;
if (4 == op3)
{
/* Handle STREXB. */
record_buf_mem[0] = 1;
thumb2_insn_r->mem_rec_count = 1;
}
else if (5 == op3)
{
/* Handle STREXH. */
record_buf_mem[0] = 2 ;
thumb2_insn_r->mem_rec_count = 1;
}
else if (7 == op3)
{
/* Handle STREXD. */
address = u_regval[0];
record_buf_mem[0] = 4;
record_buf_mem[2] = 4;
record_buf_mem[3] = address + 4;
thumb2_insn_r->mem_rec_count = 2;
}
}
else
{
offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
if (bit (thumb2_insn_r->arm_insn, 24))
{
if (bit (thumb2_insn_r->arm_insn, 23))
offset_addr = u_regval[0] + (offset_imm * 4);
else
offset_addr = u_regval[0] - (offset_imm * 4);
address = offset_addr;
}
else
address = u_regval[0];
record_buf_mem[0] = 4;
record_buf_mem[1] = address;
record_buf_mem[2] = 4;
record_buf_mem[3] = address + 4;
thumb2_insn_r->mem_rec_count = 2;
record_buf[0] = reg_rn;
thumb2_insn_r->reg_rec_count = 1;
}
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
record_buf_mem);
return ARM_RECORD_SUCCESS;
}
/* Handler for thumb2 data processing (shift register and modified immediate)
instructions. */
static int
thumb2_record_data_proc_sreg_mimm (insn_decode_record *thumb2_insn_r)
{
uint32_t reg_rd, op;
uint32_t record_buf[8];
op = bits (thumb2_insn_r->arm_insn, 21, 24);
reg_rd = bits (thumb2_insn_r->arm_insn, 8, 11);
if ((0 == op || 4 == op || 8 == op || 13 == op) && 15 == reg_rd)
{
record_buf[0] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 1;
}
else
{
record_buf[0] = reg_rd;
record_buf[1] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 2;
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
return ARM_RECORD_SUCCESS;
}
/* Generic handler for thumb2 instructions which effect destination and PS
registers. */
static int
thumb2_record_ps_dest_generic (insn_decode_record *thumb2_insn_r)
{
uint32_t reg_rd;
uint32_t record_buf[8];
reg_rd = bits (thumb2_insn_r->arm_insn, 8, 11);
record_buf[0] = reg_rd;
record_buf[1] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
return ARM_RECORD_SUCCESS;
}
/* Handler for thumb2 branch and miscellaneous control instructions. */
static int
thumb2_record_branch_misc_cntrl (insn_decode_record *thumb2_insn_r)
{
uint32_t op, op1, op2;
uint32_t record_buf[8];
op = bits (thumb2_insn_r->arm_insn, 20, 26);
op1 = bits (thumb2_insn_r->arm_insn, 12, 14);
op2 = bits (thumb2_insn_r->arm_insn, 8, 11);
/* Handle MSR insn. */
if (!(op1 & 0x2) && 0x38 == op)
{
if (!(op2 & 0x3))
{
/* CPSR is going to be changed. */
record_buf[0] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 1;
}
else
{
arm_record_unsupported_insn(thumb2_insn_r);
return -1;
}
}
else if (4 == (op1 & 0x5) || 5 == (op1 & 0x5))
{
/* BLX. */
record_buf[0] = ARM_PS_REGNUM;
record_buf[1] = ARM_LR_REGNUM;
thumb2_insn_r->reg_rec_count = 2;
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
return ARM_RECORD_SUCCESS;
}
/* Handler for thumb2 store single data item instructions. */
static int
thumb2_record_str_single_data (insn_decode_record *thumb2_insn_r)
{
struct regcache *reg_cache = thumb2_insn_r->regcache;
uint32_t reg_rn, reg_rm, offset_imm, shift_imm;
uint32_t address, offset_addr;
uint32_t record_buf[8], record_buf_mem[8];
uint32_t op1, op2;
ULONGEST u_regval[2];
op1 = bits (thumb2_insn_r->arm_insn, 21, 23);
op2 = bits (thumb2_insn_r->arm_insn, 6, 11);
reg_rn = bits (thumb2_insn_r->arm_insn, 16, 19);
regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval[0]);
if (bit (thumb2_insn_r->arm_insn, 23))
{
/* T2 encoding. */
offset_imm = bits (thumb2_insn_r->arm_insn, 0, 11);
offset_addr = u_regval[0] + offset_imm;
address = offset_addr;
}
else
{
/* T3 encoding. */
if ((0 == op1 || 1 == op1 || 2 == op1) && !(op2 & 0x20))
{
/* Handle STRB (register). */
reg_rm = bits (thumb2_insn_r->arm_insn, 0, 3);
regcache_raw_read_unsigned (reg_cache, reg_rm, &u_regval[1]);
shift_imm = bits (thumb2_insn_r->arm_insn, 4, 5);
offset_addr = u_regval[1] << shift_imm;
address = u_regval[0] + offset_addr;
}
else
{
offset_imm = bits (thumb2_insn_r->arm_insn, 0, 7);
if (bit (thumb2_insn_r->arm_insn, 10))
{
if (bit (thumb2_insn_r->arm_insn, 9))
offset_addr = u_regval[0] + offset_imm;
else
offset_addr = u_regval[0] - offset_imm;
address = offset_addr;
}
else
address = u_regval[0];
}
}
switch (op1)
{
/* Store byte instructions. */
case 4:
case 0:
record_buf_mem[0] = 1;
break;
/* Store half word instructions. */
case 1:
case 5:
record_buf_mem[0] = 2;
break;
/* Store word instructions. */
case 2:
case 6:
record_buf_mem[0] = 4;
break;
default:
gdb_assert_not_reached ("no decoding pattern found");
break;
}
record_buf_mem[1] = address;
thumb2_insn_r->mem_rec_count = 1;
record_buf[0] = reg_rn;
thumb2_insn_r->reg_rec_count = 1;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
record_buf_mem);
return ARM_RECORD_SUCCESS;
}
/* Handler for thumb2 load memory hints instructions. */
static int
thumb2_record_ld_mem_hints (insn_decode_record *thumb2_insn_r)
{
uint32_t record_buf[8];
uint32_t reg_rt, reg_rn;
reg_rt = bits (thumb2_insn_r->arm_insn, 12, 15);
reg_rn = bits (thumb2_insn_r->arm_insn, 16, 19);
if (ARM_PC_REGNUM != reg_rt)
{
record_buf[0] = reg_rt;
record_buf[1] = reg_rn;
record_buf[2] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 3;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
return ARM_RECORD_SUCCESS;
}
return ARM_RECORD_FAILURE;
}
/* Handler for thumb2 load word instructions. */
static int
thumb2_record_ld_word (insn_decode_record *thumb2_insn_r)
{
uint32_t record_buf[8];
record_buf[0] = bits (thumb2_insn_r->arm_insn, 12, 15);
record_buf[1] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 2;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
return ARM_RECORD_SUCCESS;
}
/* Handler for thumb2 long multiply, long multiply accumulate, and
divide instructions. */
static int
thumb2_record_lmul_lmla_div (insn_decode_record *thumb2_insn_r)
{
uint32_t opcode1 = 0, opcode2 = 0;
uint32_t record_buf[8];
opcode1 = bits (thumb2_insn_r->arm_insn, 20, 22);
opcode2 = bits (thumb2_insn_r->arm_insn, 4, 7);
if (0 == opcode1 || 2 == opcode1 || (opcode1 >= 4 && opcode1 <= 6))
{
/* Handle SMULL, UMULL, SMULAL. */
/* Handle SMLAL(S), SMULL(S), UMLAL(S), UMULL(S). */
record_buf[0] = bits (thumb2_insn_r->arm_insn, 16, 19);
record_buf[1] = bits (thumb2_insn_r->arm_insn, 12, 15);
record_buf[2] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 3;
}
else if (1 == opcode1 || 3 == opcode2)
{
/* Handle SDIV and UDIV. */
record_buf[0] = bits (thumb2_insn_r->arm_insn, 16, 19);
record_buf[1] = bits (thumb2_insn_r->arm_insn, 12, 15);
record_buf[2] = ARM_PS_REGNUM;
thumb2_insn_r->reg_rec_count = 3;
}
else
return ARM_RECORD_FAILURE;
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
return ARM_RECORD_SUCCESS;
}
/* Record handler for thumb32 coprocessor instructions. */
static int
thumb2_record_coproc_insn (insn_decode_record *thumb2_insn_r)
{
if (bit (thumb2_insn_r->arm_insn, 25))
return arm_record_coproc_data_proc (thumb2_insn_r);
else
return arm_record_asimd_vfp_coproc (thumb2_insn_r);
}
/* Record handler for advance SIMD structure load/store instructions. */
static int
thumb2_record_asimd_struct_ld_st (insn_decode_record *thumb2_insn_r)
{
struct regcache *reg_cache = thumb2_insn_r->regcache;
uint32_t l_bit, a_bit, b_bits;
uint32_t record_buf[128], record_buf_mem[128];
uint32_t reg_rn, reg_vd, address, f_elem;
uint32_t index_r = 0, index_e = 0, bf_regs = 0, index_m = 0, loop_t = 0;
uint8_t f_ebytes;
l_bit = bit (thumb2_insn_r->arm_insn, 21);
a_bit = bit (thumb2_insn_r->arm_insn, 23);
b_bits = bits (thumb2_insn_r->arm_insn, 8, 11);
reg_rn = bits (thumb2_insn_r->arm_insn, 16, 19);
reg_vd = bits (thumb2_insn_r->arm_insn, 12, 15);
reg_vd = (bit (thumb2_insn_r->arm_insn, 22) << 4) | reg_vd;
f_ebytes = (1 << bits (thumb2_insn_r->arm_insn, 6, 7));
f_elem = 8 / f_ebytes;
if (!l_bit)
{
ULONGEST u_regval = 0;
regcache_raw_read_unsigned (reg_cache, reg_rn, &u_regval);
address = u_regval;
if (!a_bit)
{
/* Handle VST1. */
if (b_bits == 0x02 || b_bits == 0x0a || (b_bits & 0x0e) == 0x06)
{
if (b_bits == 0x07)
bf_regs = 1;
else if (b_bits == 0x0a)
bf_regs = 2;
else if (b_bits == 0x06)
bf_regs = 3;
else if (b_bits == 0x02)
bf_regs = 4;
else
bf_regs = 0;
for (index_r = 0; index_r < bf_regs; index_r++)
{
for (index_e = 0; index_e < f_elem; index_e++)
{
record_buf_mem[index_m++] = f_ebytes;
record_buf_mem[index_m++] = address;
address = address + f_ebytes;
thumb2_insn_r->mem_rec_count += 1;
}
}
}
/* Handle VST2. */
else if (b_bits == 0x03 || (b_bits & 0x0e) == 0x08)
{
if (b_bits == 0x09 || b_bits == 0x08)
bf_regs = 1;
else if (b_bits == 0x03)
bf_regs = 2;
else
bf_regs = 0;
for (index_r = 0; index_r < bf_regs; index_r++)
for (index_e = 0; index_e < f_elem; index_e++)
{
for (loop_t = 0; loop_t < 2; loop_t++)
{
record_buf_mem[index_m++] = f_ebytes;
record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
thumb2_insn_r->mem_rec_count += 1;
}
address = address + (2 * f_ebytes);
}
}
/* Handle VST3. */
else if ((b_bits & 0x0e) == 0x04)
{
for (index_e = 0; index_e < f_elem; index_e++)
{
for (loop_t = 0; loop_t < 3; loop_t++)
{
record_buf_mem[index_m++] = f_ebytes;
record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
thumb2_insn_r->mem_rec_count += 1;
}
address = address + (3 * f_ebytes);
}
}
/* Handle VST4. */
else if (!(b_bits & 0x0e))
{
for (index_e = 0; index_e < f_elem; index_e++)
{
for (loop_t = 0; loop_t < 4; loop_t++)
{
record_buf_mem[index_m++] = f_ebytes;
record_buf_mem[index_m++] = address + (loop_t * f_ebytes);
thumb2_insn_r->mem_rec_count += 1;
}
address = address + (4 * f_ebytes);
}
}
}
else
{
uint8_t bft_size = bits (thumb2_insn_r->arm_insn, 10, 11);
if (bft_size == 0x00)
f_ebytes = 1;
else if (bft_size == 0x01)
f_ebytes = 2;
else if (bft_size == 0x02)
f_ebytes = 4;
else
f_ebytes = 0;
/* Handle VST1. */
if (!(b_bits & 0x0b) || b_bits == 0x08)
thumb2_insn_r->mem_rec_count = 1;
/* Handle VST2. */
else if ((b_bits & 0x0b) == 0x01 || b_bits == 0x09)
thumb2_insn_r->mem_rec_count = 2;
/* Handle VST3. */
else if ((b_bits & 0x0b) == 0x02 || b_bits == 0x0a)
thumb2_insn_r->mem_rec_count = 3;
/* Handle VST4. */
else if ((b_bits & 0x0b) == 0x03 || b_bits == 0x0b)
thumb2_insn_r->mem_rec_count = 4;
for (index_m = 0; index_m < thumb2_insn_r->mem_rec_count; index_m++)
{
record_buf_mem[index_m] = f_ebytes;
record_buf_mem[index_m] = address + (index_m * f_ebytes);
}
}
}
else
{
if (!a_bit)
{
/* Handle VLD1. */
if (b_bits == 0x02 || b_bits == 0x0a || (b_bits & 0x0e) == 0x06)
thumb2_insn_r->reg_rec_count = 1;
/* Handle VLD2. */
else if (b_bits == 0x03 || (b_bits & 0x0e) == 0x08)
thumb2_insn_r->reg_rec_count = 2;
/* Handle VLD3. */
else if ((b_bits & 0x0e) == 0x04)
thumb2_insn_r->reg_rec_count = 3;
/* Handle VLD4. */
else if (!(b_bits & 0x0e))
thumb2_insn_r->reg_rec_count = 4;
}
else
{
/* Handle VLD1. */
if (!(b_bits & 0x0b) || b_bits == 0x08 || b_bits == 0x0c)
thumb2_insn_r->reg_rec_count = 1;
/* Handle VLD2. */
else if ((b_bits & 0x0b) == 0x01 || b_bits == 0x09 || b_bits == 0x0d)
thumb2_insn_r->reg_rec_count = 2;
/* Handle VLD3. */
else if ((b_bits & 0x0b) == 0x02 || b_bits == 0x0a || b_bits == 0x0e)
thumb2_insn_r->reg_rec_count = 3;
/* Handle VLD4. */
else if ((b_bits & 0x0b) == 0x03 || b_bits == 0x0b || b_bits == 0x0f)
thumb2_insn_r->reg_rec_count = 4;
for (index_r = 0; index_r < thumb2_insn_r->reg_rec_count; index_r++)
record_buf[index_r] = reg_vd + ARM_D0_REGNUM + index_r;
}
}
if (bits (thumb2_insn_r->arm_insn, 0, 3) != 15)
{
record_buf[index_r] = reg_rn;
thumb2_insn_r->reg_rec_count += 1;
}
REG_ALLOC (thumb2_insn_r->arm_regs, thumb2_insn_r->reg_rec_count,
record_buf);
MEM_ALLOC (thumb2_insn_r->arm_mems, thumb2_insn_r->mem_rec_count,
record_buf_mem);
return 0;
}
/* Decodes thumb2 instruction type and invokes its record handler. */
static unsigned int
thumb2_record_decode_insn_handler (insn_decode_record *thumb2_insn_r)
{
uint32_t op, op1, op2;
op = bit (thumb2_insn_r->arm_insn, 15);
op1 = bits (thumb2_insn_r->arm_insn, 27, 28);
op2 = bits (thumb2_insn_r->arm_insn, 20, 26);
if (op1 == 0x01)
{
if (!(op2 & 0x64 ))
{
/* Load/store multiple instruction. */
return thumb2_record_ld_st_multiple (thumb2_insn_r);
}
else if ((op2 & 0x64) == 0x4)
{
/* Load/store (dual/exclusive) and table branch instruction. */
return thumb2_record_ld_st_dual_ex_tbb (thumb2_insn_r);
}
else if ((op2 & 0x60) == 0x20)
{
/* Data-processing (shifted register). */
return thumb2_record_data_proc_sreg_mimm (thumb2_insn_r);
}
else if (op2 & 0x40)
{
/* Co-processor instructions. */
return thumb2_record_coproc_insn (thumb2_insn_r);
}
}
else if (op1 == 0x02)
{
if (op)
{
/* Branches and miscellaneous control instructions. */
return thumb2_record_branch_misc_cntrl (thumb2_insn_r);
}
else if (op2 & 0x20)
{
/* Data-processing (plain binary immediate) instruction. */
return thumb2_record_ps_dest_generic (thumb2_insn_r);
}
else
{
/* Data-processing (modified immediate). */
return thumb2_record_data_proc_sreg_mimm (thumb2_insn_r);
}
}
else if (op1 == 0x03)
{
if (!(op2 & 0x71 ))
{
/* Store single data item. */
return thumb2_record_str_single_data (thumb2_insn_r);
}
else if (!((op2 & 0x71) ^ 0x10))
{
/* Advanced SIMD or structure load/store instructions. */
return thumb2_record_asimd_struct_ld_st (thumb2_insn_r);
}
else if (!((op2 & 0x67) ^ 0x01))
{
/* Load byte, memory hints instruction. */
return thumb2_record_ld_mem_hints (thumb2_insn_r);
}
else if (!((op2 & 0x67) ^ 0x03))
{
/* Load halfword, memory hints instruction. */
return thumb2_record_ld_mem_hints (thumb2_insn_r);
}
else if (!((op2 & 0x67) ^ 0x05))
{
/* Load word instruction. */
return thumb2_record_ld_word (thumb2_insn_r);
}
else if (!((op2 & 0x70) ^ 0x20))
{
/* Data-processing (register) instruction. */
return thumb2_record_ps_dest_generic (thumb2_insn_r);
}
else if (!((op2 & 0x78) ^ 0x30))
{
/* Multiply, multiply accumulate, abs diff instruction. */
return thumb2_record_ps_dest_generic (thumb2_insn_r);
}
else if (!((op2 & 0x78) ^ 0x38))
{
/* Long multiply, long multiply accumulate, and divide. */
return thumb2_record_lmul_lmla_div (thumb2_insn_r);
}
else if (op2 & 0x40)
{
/* Co-processor instructions. */
return thumb2_record_coproc_insn (thumb2_insn_r);
}
}
return -1;
}
namespace {
/* Abstract memory reader. */
class abstract_memory_reader
{
public:
/* Read LEN bytes of target memory at address MEMADDR, placing the
results in GDB's memory at BUF. Return true on success. */
virtual bool read (CORE_ADDR memaddr, gdb_byte *buf, const size_t len) = 0;
};
/* Instruction reader from real target. */
class instruction_reader : public abstract_memory_reader
{
public:
bool read (CORE_ADDR memaddr, gdb_byte *buf, const size_t len) override
{
if (target_read_memory (memaddr, buf, len))
return false;
else
return true;
}
};
} // namespace
/* Extracts arm/thumb/thumb2 insn depending on the size, and returns 0 on success
[gdb] Fix more typos in comments Fix typos in comments. NFC. Tested on x86_64-linux. gdb/ChangeLog: 2019-10-18 Tom de Vries <tdevries@suse.de> * aarch64-tdep.c: Fix typos in comments. * ada-lang.c: Same. * ada-tasks.c: Same. * alpha-tdep.c: Same. * alpha-tdep.h: Same. * amd64-nat.c: Same. * amd64-windows-tdep.c: Same. * arc-tdep.c: Same. * arc-tdep.h: Same. * arch-utils.c: Same. * arm-nbsd-tdep.c: Same. * arm-tdep.c: Same. * ax-gdb.c: Same. * blockframe.c: Same. * btrace.c: Same. * c-varobj.c: Same. * coff-pe-read.c: Same. * coffread.c: Same. * cris-tdep.c: Same. * darwin-nat.c: Same. * dbxread.c: Same. * dcache.c: Same. * disasm.c: Same. * dtrace-probe.c: Same. * dwarf-index-write.c: Same. * dwarf2-frame-tailcall.c: Same. * dwarf2-frame.c: Same. * dwarf2read.c: Same. * eval.c: Same. * exceptions.c: Same. * fbsd-tdep.c: Same. * findvar.c: Same. * frame.c: Same. * frv-tdep.c: Same. * gnu-v3-abi.c: Same. * go32-nat.c: Same. * h8300-tdep.c: Same. * hppa-tdep.c: Same. * i386-linux-tdep.c: Same. * i386-tdep.c: Same. * ia64-libunwind-tdep.c: Same. * ia64-tdep.c: Same. * infcmd.c: Same. * infrun.c: Same. * linespec.c: Same. * linux-nat.c: Same. * linux-thread-db.c: Same. * machoread.c: Same. * mdebugread.c: Same. * mep-tdep.c: Same. * mn10300-tdep.c: Same. * namespace.c: Same. * objfiles.c: Same. * opencl-lang.c: Same. * or1k-tdep.c: Same. * osabi.c: Same. * ppc-linux-nat.c: Same. * ppc-linux-tdep.c: Same. * ppc-sysv-tdep.c: Same. * printcmd.c: Same. * procfs.c: Same. * record-btrace.c: Same. * record-full.c: Same. * remote-fileio.c: Same. * remote.c: Same. * rs6000-tdep.c: Same. * s12z-tdep.c: Same. * score-tdep.c: Same. * ser-base.c: Same. * ser-go32.c: Same. * skip.c: Same. * sol-thread.c: Same. * solib-svr4.c: Same. * solib.c: Same. * source.c: Same. * sparc-nat.c: Same. * sparc-sol2-tdep.c: Same. * sparc-tdep.c: Same. * sparc64-tdep.c: Same. * stabsread.c: Same. * stack.c: Same. * symfile.c: Same. * symtab.c: Same. * target-descriptions.c: Same. * target-float.c: Same. * thread.c: Same. * utils.c: Same. * valops.c: Same. * valprint.c: Same. * value.c: Same. * varobj.c: Same. * windows-nat.c: Same. * xcoffread.c: Same. * xstormy16-tdep.c: Same. * xtensa-tdep.c: Same. Change-Id: I5175f1b107bfa4e1cdd4a3361ccb4739e53c75c4
2019-10-18 02:48:08 +02:00
and positive val on failure. */
static int
extract_arm_insn (abstract_memory_reader& reader,
insn_decode_record *insn_record, uint32_t insn_size)
{
gdb_byte buf[insn_size];
memset (&buf[0], 0, insn_size);
if (!reader.read (insn_record->this_addr, buf, insn_size))
return 1;
insn_record->arm_insn = (uint32_t) extract_unsigned_integer (&buf[0],
insn_size,
gdbarch_byte_order_for_code (insn_record->gdbarch));
return 0;
}
typedef int (*sti_arm_hdl_fp_t) (insn_decode_record*);
/* Decode arm/thumb insn depending on condition cods and opcodes; and
dispatch it. */
static int
decode_insn (abstract_memory_reader &reader, insn_decode_record *arm_record,
record_type_t record_type, uint32_t insn_size)
{
/* (Starting from numerical 0); bits 25, 26, 27 decodes type of arm
instruction. */
static const sti_arm_hdl_fp_t arm_handle_insn[8] =
{
arm_record_data_proc_misc_ld_str, /* 000. */
arm_record_data_proc_imm, /* 001. */
arm_record_ld_st_imm_offset, /* 010. */
arm_record_ld_st_reg_offset, /* 011. */
arm_record_ld_st_multiple, /* 100. */
arm_record_b_bl, /* 101. */
arm_record_asimd_vfp_coproc, /* 110. */
arm_record_coproc_data_proc /* 111. */
};
/* (Starting from numerical 0); bits 13,14,15 decodes type of thumb
instruction. */
static const sti_arm_hdl_fp_t thumb_handle_insn[8] =
{ \
thumb_record_shift_add_sub, /* 000. */
thumb_record_add_sub_cmp_mov, /* 001. */
thumb_record_ld_st_reg_offset, /* 010. */
thumb_record_ld_st_imm_offset, /* 011. */
thumb_record_ld_st_stack, /* 100. */
thumb_record_misc, /* 101. */
thumb_record_ldm_stm_swi, /* 110. */
thumb_record_branch /* 111. */
};
uint32_t ret = 0; /* return value: negative:failure 0:success. */
uint32_t insn_id = 0;
if (extract_arm_insn (reader, arm_record, insn_size))
{
if (record_debug)
{
printf_unfiltered (_("Process record: error reading memory at "
"addr %s len = %d.\n"),
paddress (arm_record->gdbarch,
arm_record->this_addr), insn_size);
}
return -1;
}
else if (ARM_RECORD == record_type)
{
arm_record->cond = bits (arm_record->arm_insn, 28, 31);
insn_id = bits (arm_record->arm_insn, 25, 27);
if (arm_record->cond == 0xf)
ret = arm_record_extension_space (arm_record);
else
{
/* If this insn has fallen into extension space
then we need not decode it anymore. */
ret = arm_handle_insn[insn_id] (arm_record);
}
if (ret != ARM_RECORD_SUCCESS)
{
arm_record_unsupported_insn (arm_record);
ret = -1;
}
}
else if (THUMB_RECORD == record_type)
{
/* As thumb does not have condition codes, we set negative. */
arm_record->cond = -1;
insn_id = bits (arm_record->arm_insn, 13, 15);
ret = thumb_handle_insn[insn_id] (arm_record);
if (ret != ARM_RECORD_SUCCESS)
{
arm_record_unsupported_insn (arm_record);
ret = -1;
}
}
else if (THUMB2_RECORD == record_type)
{
/* As thumb does not have condition codes, we set negative. */
arm_record->cond = -1;
/* Swap first half of 32bit thumb instruction with second half. */
arm_record->arm_insn
= (arm_record->arm_insn >> 16) | (arm_record->arm_insn << 16);
ret = thumb2_record_decode_insn_handler (arm_record);
if (ret != ARM_RECORD_SUCCESS)
{
arm_record_unsupported_insn (arm_record);
ret = -1;
}
}
else
{
/* Throw assertion. */
gdb_assert_not_reached ("not a valid instruction, could not decode");
}
return ret;
}
#if GDB_SELF_TEST
namespace selftests {
/* Provide both 16-bit and 32-bit thumb instructions. */
class instruction_reader_thumb : public abstract_memory_reader
{
public:
template<size_t SIZE>
instruction_reader_thumb (enum bfd_endian endian,
const uint16_t (&insns)[SIZE])
: m_endian (endian), m_insns (insns), m_insns_size (SIZE)
{}
bool read (CORE_ADDR memaddr, gdb_byte *buf, const size_t len) override
{
SELF_CHECK (len == 4 || len == 2);
SELF_CHECK (memaddr % 2 == 0);
SELF_CHECK ((memaddr / 2) < m_insns_size);
store_unsigned_integer (buf, 2, m_endian, m_insns[memaddr / 2]);
if (len == 4)
{
store_unsigned_integer (&buf[2], 2, m_endian,
m_insns[memaddr / 2 + 1]);
}
return true;
}
private:
enum bfd_endian m_endian;
const uint16_t *m_insns;
size_t m_insns_size;
};
static void
arm_record_test (void)
{
struct gdbarch_info info;
gdbarch_info_init (&info);
info.bfd_arch_info = bfd_scan_arch ("arm");
struct gdbarch *gdbarch = gdbarch_find_by_info (info);
SELF_CHECK (gdbarch != NULL);
/* 16-bit Thumb instructions. */
{
insn_decode_record arm_record;
memset (&arm_record, 0, sizeof (insn_decode_record));
arm_record.gdbarch = gdbarch;
static const uint16_t insns[] = {
/* db b2 uxtb r3, r3 */
0xb2db,
/* cd 58 ldr r5, [r1, r3] */
0x58cd,
};
enum bfd_endian endian = gdbarch_byte_order_for_code (arm_record.gdbarch);
instruction_reader_thumb reader (endian, insns);
int ret = decode_insn (reader, &arm_record, THUMB_RECORD,
THUMB_INSN_SIZE_BYTES);
SELF_CHECK (ret == 0);
SELF_CHECK (arm_record.mem_rec_count == 0);
SELF_CHECK (arm_record.reg_rec_count == 1);
SELF_CHECK (arm_record.arm_regs[0] == 3);
arm_record.this_addr += 2;
ret = decode_insn (reader, &arm_record, THUMB_RECORD,
THUMB_INSN_SIZE_BYTES);
SELF_CHECK (ret == 0);
SELF_CHECK (arm_record.mem_rec_count == 0);
SELF_CHECK (arm_record.reg_rec_count == 1);
SELF_CHECK (arm_record.arm_regs[0] == 5);
}
/* 32-bit Thumb-2 instructions. */
{
insn_decode_record arm_record;
memset (&arm_record, 0, sizeof (insn_decode_record));
arm_record.gdbarch = gdbarch;
static const uint16_t insns[] = {
/* 1d ee 70 7f mrc 15, 0, r7, cr13, cr0, {3} */
0xee1d, 0x7f70,
};
enum bfd_endian endian = gdbarch_byte_order_for_code (arm_record.gdbarch);
instruction_reader_thumb reader (endian, insns);
int ret = decode_insn (reader, &arm_record, THUMB2_RECORD,
THUMB2_INSN_SIZE_BYTES);
SELF_CHECK (ret == 0);
SELF_CHECK (arm_record.mem_rec_count == 0);
SELF_CHECK (arm_record.reg_rec_count == 1);
SELF_CHECK (arm_record.arm_regs[0] == 7);
}
}
} // namespace selftests
#endif /* GDB_SELF_TEST */
/* Cleans up local record registers and memory allocations. */
static void
deallocate_reg_mem (insn_decode_record *record)
{
xfree (record->arm_regs);
xfree (record->arm_mems);
}
/* Parse the current instruction and record the values of the registers and
memory that will be changed in current instruction to record_arch_list".
Return -1 if something is wrong. */
int
arm_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
CORE_ADDR insn_addr)
{
uint32_t no_of_rec = 0;
uint32_t ret = 0; /* return value: -1:record failure ; 0:success */
ULONGEST t_bit = 0, insn_id = 0;
ULONGEST u_regval = 0;
insn_decode_record arm_record;
memset (&arm_record, 0, sizeof (insn_decode_record));
arm_record.regcache = regcache;
arm_record.this_addr = insn_addr;
arm_record.gdbarch = gdbarch;
if (record_debug > 1)
{
fprintf_unfiltered (gdb_stdlog, "Process record: arm_process_record "
"addr = %s\n",
paddress (gdbarch, arm_record.this_addr));
}
instruction_reader reader;
if (extract_arm_insn (reader, &arm_record, 2))
{
if (record_debug)
{
printf_unfiltered (_("Process record: error reading memory at "
"addr %s len = %d.\n"),
paddress (arm_record.gdbarch,
arm_record.this_addr), 2);
}
return -1;
}
/* Check the insn, whether it is thumb or arm one. */
t_bit = arm_psr_thumb_bit (arm_record.gdbarch);
regcache_raw_read_unsigned (arm_record.regcache, ARM_PS_REGNUM, &u_regval);
if (!(u_regval & t_bit))
{
/* We are decoding arm insn. */
ret = decode_insn (reader, &arm_record, ARM_RECORD, ARM_INSN_SIZE_BYTES);
}
else
{
insn_id = bits (arm_record.arm_insn, 11, 15);
/* is it thumb2 insn? */
if ((0x1D == insn_id) || (0x1E == insn_id) || (0x1F == insn_id))
{
ret = decode_insn (reader, &arm_record, THUMB2_RECORD,
THUMB2_INSN_SIZE_BYTES);
}
else
{
/* We are decoding thumb insn. */
ret = decode_insn (reader, &arm_record, THUMB_RECORD,
THUMB_INSN_SIZE_BYTES);
}
}
if (0 == ret)
{
/* Record registers. */
record_full_arch_list_add_reg (arm_record.regcache, ARM_PC_REGNUM);
if (arm_record.arm_regs)
{
for (no_of_rec = 0; no_of_rec < arm_record.reg_rec_count; no_of_rec++)
{
if (record_full_arch_list_add_reg
(arm_record.regcache , arm_record.arm_regs[no_of_rec]))
ret = -1;
}
}
/* Record memories. */
if (arm_record.arm_mems)
{
for (no_of_rec = 0; no_of_rec < arm_record.mem_rec_count; no_of_rec++)
{
if (record_full_arch_list_add_mem
((CORE_ADDR)arm_record.arm_mems[no_of_rec].addr,
arm_record.arm_mems[no_of_rec].len))
ret = -1;
}
}
if (record_full_arch_list_add_end ())
ret = -1;
}
deallocate_reg_mem (&arm_record);
return ret;
}
/* See arm-tdep.h. */
const target_desc *
arm_read_description (arm_fp_type fp_type)
{
struct target_desc *tdesc = tdesc_arm_list[fp_type];
if (tdesc == nullptr)
{
tdesc = arm_create_target_description (fp_type);
tdesc_arm_list[fp_type] = tdesc;
}
return tdesc;
}
/* See arm-tdep.h. */
const target_desc *
arm_read_mprofile_description (arm_m_profile_type m_type)
{
struct target_desc *tdesc = tdesc_arm_mprofile_list[m_type];
if (tdesc == nullptr)
{
tdesc = arm_create_mprofile_target_description (m_type);
tdesc_arm_mprofile_list[m_type] = tdesc;
}
return tdesc;
}