aboutsummaryrefslogtreecommitdiff
path: root/gdb/aarch64-tdep.h
AgeCommit message (Collapse)AuthorFilesLines
2020-10-29gdb: remove parameter of gdbarch_displaced_step_hw_singlestepSimon Marchi1-2/+1
I noticed that the closure parameter of gdbarch_displaced_step_hw_singlestep is never used by any implementation of the method, so this patch removes it. gdb/ChangeLog: * gdbarch.sh (displaced_step_hw_singlestep): Remove closure parameter. * aarch64-tdep.c (aarch64_displaced_step_hw_singlestep): Likewise. * aarch64-tdep.h (aarch64_displaced_step_hw_singlestep): Likewise. * arch-utils.c (default_displaced_step_hw_singlestep): Likewise. * arch-utils.h (default_displaced_step_hw_singlestep): Likewise. * rs6000-tdep.c (ppc_displaced_step_hw_singlestep): Likewise. * s390-tdep.c (s390_displaced_step_hw_singlestep): Likewise. * gdbarch.c: Re-generate. * gdbarch.h: Re-generate. * infrun.c (resume_1): Adjust. Change-Id: I7354f0b22afc2692ebff0cd700a462db8f389fc1
2020-10-20gdb: make gdbarch_displaced_step_hw_singlestep return boolSimon Marchi1-2/+2
Replace the int-used-as-a-bool with a bool. gdb/ChangeLog: * gdbarch.sh (displaced_step_hw_singlestep): Return bool. * gdbarch.c: Re-generate. * gdbarch.h: Re-generate. * aarch64-tdep.c (aarch64_displaced_step_hw_singlestep): Return bool. * aarch64-tdep.h (aarch64_displaced_step_hw_singlestep): Likewise. * arch-utils.h (default_displaced_step_hw_singlestep): Likewise. * arch-utils.c (default_displaced_step_hw_singlestep): Likewise. * rs6000-tdep.c (ppc_displaced_step_hw_singlestep): Likewise. * s390-tdep.c (s390_displaced_step_hw_singlestep): Likewise. Change-Id: I76a78366dc5c0afb03f8f4bddf9f4e8d68fe3114
2020-02-14gdb: introduce displaced_step_closure_up type aliasSimon Marchi1-1/+2
To help with readability, add the type displaced_step_closure_up, an alias for std::unique_ptr<displaced_step_closure>, and use it throughout the code base. gdb/ChangeLog: * aarch64-tdep.c (aarch64_displaced_step_copy_insn): Use displaced_step_closure_up. * aarch64-tdep.h (aarch64_displaced_step_copy_insn): Likewise. (struct displaced_step_closure_up): * amd64-tdep.c (amd64_displaced_step_copy_insn): Likewise. * amd64-tdep.h (amd64_displaced_step_copy_insn): Likewise. * arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise. * gdbarch.sh (displaced_step_copy_insn): Likewise. * gdbarch.c, gdbarch.h: Re-generate. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Use displaced_step_closure_up. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. * i386-tdep.h (i386_displaced_step_copy_insn): Likewise. * infrun.h (displaced_step_closure_up): New type alias. (struct displaced_step_inferior_state) <step_closure>: Change type to displaced_step_closure_up. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Use displaced_step_closure_up. * s390-tdep.c (s390_displaced_step_copy_insn): Likewise.
2020-02-14gdb: make gdbarch_displaced_step_copy_insn return an std::unique_ptrSimon Marchi1-1/+1
This callback dynamically allocates a specialized displaced_step_closure, and gives the ownership of the object to its caller. So I think it would make sense for the callback to return an std::unique_ptr, this is what this patch implements. gdb/ChangeLog: * gdbarch.sh (displaced_step_copy_insn): Change return type to an std::unique_ptr. * gdbarch.c: Re-generate. * gdbarch.h: Re-generate. * infrun.c (displaced_step_prepare_throw): Adjust to std::unique_ptr change. * aarch64-tdep.c (aarch64_displaced_step_copy_insn): Change return type to std::unique_ptr. * aarch64-tdep.h (aarch64_displaced_step_copy_insn): Likewise. * amd64-tdep.c (amd64_displaced_step_copy_insn): Likewise. * amd64-tdep.h (amd64_displaced_step_copy_insn): Likewise. * arm-linux-tdep.c (arm_linux_displaced_step_copy_insn): Likewise. * i386-linux-tdep.c (i386_linux_displaced_step_copy_insn): Likewise. * i386-tdep.c (i386_displaced_step_copy_insn): Likewise. * i386-tdep.h (i386_displaced_step_copy_insn): Likewise. * rs6000-tdep.c (ppc_displaced_step_copy_insn): Likewise. * s390-tdep.c (s390_displaced_step_copy_insn): Likewise.
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-07-04Arm/AArch64: Split DISPLACED_MODIFIED_INSNS name clashAlan Hayward1-1/+1
Both targets define DISPLACED_MODIFIED_INSNS, each with different values. Add ARM_ and AARCH64_ to the start of the name to prevent confusion. No functionality changes. gdb/ChangeLog: * aarch64-linux-tdep.c (aarch64_linux_init_abi): Use AARCH64_DISPLACED_MODIFIED_INSNS. * aarch64-tdep.c (struct aarch64_displaced_step_data) (aarch64_displaced_step_copy_insn): Likewise. * aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): Rename from.. (AARCH64_DISPLACED_MODIFIED_INSNS): ...to this. * arm-linux-tdep.c (arm_linux_cleanup_svc): Use ARM_DISPLACED_MODIFIED_INSNS. * arm-tdep.c (arm_gdbarch_init): Likewise. * arm-tdep.h (DISPLACED_MODIFIED_INSNS): Rename from.. (ARM_DISPLACED_MODIFIED_INSNS): ...to this. (struct arm_displaced_step_closure): Use ARM_DISPLACED_MODIFIED_INSNS.
2019-03-22AArch64: Add pauth DWARF registersAlan Hayward1-0/+4
Map the pauth registers to DWARF. Add a new pseudo register ra_state and also map this to DWARF. This register is hidden from the user - prevent it from being read or written to. It will be used for the unmangling of addresses. gdb/ChangeLog: * aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Check for pauth registers. (aarch64_pseudo_register_name): Likewise. (aarch64_pseudo_register_type): Likewise. (aarch64_pseudo_register_reggroup_p): Likewise. (aarch64_gdbarch_init): Add pauth registers. * aarch64-tdep.h (AARCH64_DWARF_PAUTH_RA_STATE): New define. (AARCH64_DWARF_PAUTH_DMASK): Likewise. (AARCH64_DWARF_PAUTH_CMASK): Likewise. (struct gdbarch_tdep): Add regnum for ra_state.
2019-03-22AArch64: Read pauth registersAlan Hayward1-0/+8
Initialise the pauth registers when creating a target description, and store the regnum of the first pauth register. Use ptrace to read the registers in the pauth feature. Do not allow the registers to be written. gdb/ChangeLog: * aarch64-linux-nat.c (fetch_pauth_masks_from_thread): New function. (aarch64_linux_nat_target::fetch_registers): Read pauth registers. * aarch64-tdep.c (aarch64_cannot_store_register): New function. (aarch64_gdbarch_init): Add puth registers. * aarch64-tdep.h (struct gdbarch_tdep): Add pauth features. * arch/aarch64.h (AARCH64_PAUTH_DMASK_REGNUM): New define. (AARCH64_PAUTH_CMASK_REGNUM): Likewise.
2019-03-22AArch64: Add pointer authentication featureAlan Hayward1-1/+1
Pointer Authentication is a new feature in AArch64 v8.3-a. When enabled in the compiler, function return addresses will be mangled by the kernel. Add register description xml and wire up to aarch64_linux_read_description. This description includes the two pauth user registers. Nothing yet uses the feature - that is added in later patches. gdb/ChangeLog: * aarch64-linux-nat.c (aarch64_linux_nat_target::read_description): Add pauth param. * aarch64-linux-tdep.c (aarch64_linux_core_read_description): Likewise. * aarch64-tdep.c (struct target_desc): Add in pauth. (aarch64_read_description): Add pauth param. (aarch64_gdbarch_init): Likewise. * aarch64-tdep.h (aarch64_read_description): Likewise. * arch/aarch64.c (aarch64_create_target_description): Likewise. * arch/aarch64.h (aarch64_create_target_description): Likewise. * features/Makefile: Add new files. * features/aarch64-pauth.c: New file. * features/aarch64-pauth.xml: New file. gdb/doc/ChangeLog: * gdb.texinfo: Describe pauth feature. gdb/gdbserver/ChangeLog: * linux-aarch64-ipa.c (get_ipa_tdesc): Add pauth param. (initialize_low_tracepoint): Likewise. * linux-aarch64-low.c (aarch64_arch_setup): Likewise. * linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Likewise. * linux-aarch64-tdesc.c (struct target_desc): Likewise. (aarch64_linux_read_description): Likewise. * linux-aarch64-tdesc.h (aarch64_linux_read_description): Likewise.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-06-11Add Aarch64 SVE dwarf regnumsAlan Hayward1-0/+4
This is as per the spec: https://developer.arm.com/products/architecture/a-profile/docs/100985/0000 gdb/ * aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Add mappings. * aarch64-tdep.h (AARCH64_DWARF_SVE_VG): Add define. (AARCH64_DWARF_SVE_FFR): Likewise. (AARCH64_DWARF_SVE_P0): Likewise. (AARCH64_DWARF_SVE_Z0): Likewise.
2018-06-07Aarch64 SVE pseudo register supportAlan Hayward1-0/+1
Add the functionality for reading/writing pseudo registers. On SVE the V registers are pseudo registers. This is supported by adding AARCH64_SVE_V0_REGNUM. * aarch64-tdep.c (AARCH64_SVE_V0_REGNUM): Add define. (aarch64_vnv_type): Add function. (aarch64_pseudo_register_name): Add V regs for SVE. (aarch64_pseudo_register_type): Likewise. (aarch64_pseudo_register_reggroup_p): Likewise. (aarch64_pseudo_read_value_2): Use V0 offset for SVE (aarch64_pseudo_read_value): Add V regs for SVE. (aarch64_pseudo_write_2): Use V0 offset for SVE (aarch64_pseudo_write): Add V regs for SVE. * aarch64-tdep.h (struct gdbarch_tdep): Add vnv_type.
2018-06-04Use uint64_t for aarch64 tdep VQAlan Hayward1-1/+1
2018-06-04Enable SVE for GDBAlan Hayward1-0/+9
Enable SVE support for GDB by reading the VQ when creating a target description. Also ensurse that SVE is taken into account when creating the tdep structure, and store the current VQ value directly in tdep. gdb/ * aarch64-linux-nat.c (aarch64_linux_read_description): Support SVE. * aarch64-tdep.c (aarch64_get_tdesc_vq): New function. (aarch64_gdbarch_init): Check for SVE. * aarch64-tdep.h (gdbarch_tdep::has_sve): New function.
2018-06-04Use uint64_t for SVE VQAlan Hayward1-1/+1
Previously VQ was of type long. Using uint64_t ensures it always matches the same type as the VG register. Note that in the Linux kernel, VQ is 16bits. We cast it up to 64bits immediately after reading to ensure we always use the same type throughout the code. gdb/ * aarch64-tdep.c (aarch64_read_description): Use uint64_t for VQ. * aarch64-tdep.h (aarch64_read_description): Likewise. * arch/aarch64.c (aarch64_create_target_description): Likewise. * arch/aarch64.h (aarch64_create_target_description): Likewise. * features/aarch64-sve.c (create_feature_aarch64_sve): Likewise. * nat/aarch64-sve-linux-ptrace.c(aarch64_sve_get_vq): Likewise. * nat/aarch64-sve-linux-ptrace.h (aarch64_sve_get_vq): Likewise.
2018-05-31Add Aarch64 SVE target descriptionAlan Hayward1-1/+1
No code uses the new descriptions yet. gdb/ * aarch64-linux-nat.c (aarch64_linux_read_description): Add parmeter zero. * aarch64-linux-tdep.c (aarch64_linux_core_read_description): Likewise. * aarch64-tdep.c (tdesc_aarch64_list): Add. (aarch64_read_description): Use VQ to index tdesc_aarch64_list. (aarch64_gdbarch_init): Add parmeter zero. * aarch64-tdep.h (aarch64_read_description): Add VQ parmeter. * arch/aarch64.c (aarch64_create_target_description): Check VQ. * arch/aarch64.h (aarch64_create_target_description): Add VQ. parmeter. * doc/gdb.texinfo: Describe SVE feature * features/aarch64-sve.c: New file. gdbserver/ * linux-aarch64-tdesc.c (aarch64_linux_read_description): Add null VQ.
2018-01-02Update copyright year range in all GDB filesJoel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files
2017-11-24Add aarch64_create_target_descriptionAlan Hayward1-1/+1
gdb/ * Makefile.in: Add new files. * aarch64-linux-nat.c (aarch64_linux_read_description): Call aarch64_read_description. * aarch64-linux-tdep.c (aarch64_linux_core_read_description): Call aarch64_read_description. * aarch64-tdep.c (aarch64_read_description): New function. (aarch64_gdbarch_init): Call aarch64_read_description. * aarch64-tdep.h (aarch64_read_description): New function. * arch/aarch64.c: New file. * configure.tgt: Add new files.
2017-10-25Add common AARCH64 REGNUM definesAlan Hayward1-26/+2
gdb/ * aarch64-tdep.h (enum aarch64_regnum): Remove. * arch/aarch64.h: New file. gdbserver/ * linux-aarch64-low.c (aarch64_fill_gregset): Replace defines with REGNO. (aarch64_store_gregset): Likewise. (aarch64_fill_fpregset): Likewise. (aarch64_store_fpregset): Likewise.
2017-01-01update copyright year range in GDB filesJoel Brobecker1-1/+1
This applies the second part of GDB's End of Year Procedure, which updates the copyright year range in all of GDB's files. gdb/ChangeLog: Update copyright year range in all GDB files.
2016-10-12[AArch64] Track FP registers in prologue analyzerYao Qi1-0/+2
We don't track FP registers in aarch64 prologue analyzer, so this causes an internal error when FP registers are saved by "stp" instruction in prologue (stp d8, d9, [sp,#128]), tbreak _Unwind_RaiseException^M aarch64-tdep.c:335: internal-error: CORE_ADDR aarch64_analyze_prologue(gdbarch*, CORE_ADDR, CORE_ADDR, aarch64_prologue_cache*): Assertion `inst.operands[0].type == AARCH64_OPND_Rt' failed.^M A problem internal to GDB has been detected, This patch teaches GDB to track FP registers (D registers) in prologue analyzer. gdb: 2016-10-12 Yao Qi <yao.qi@linaro.org> PR tdep/20682 * aarch64-tdep.c: Replace 32 with AARCH64_D_REGISTER_COUNT. (aarch64_analyze_prologue): Extend array 'regs' for D registers. Assert that operand 0 and 1 can be X or D registers. Update register number for D registers. Update registers in frame cache. * aarch64-tdep.h (AARCH64_D_REGISTER_COUNT): New macro.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-10-12Support displaced stepping in aarch64-linuxYao Qi1-0/+17
This patch is to support displaced stepping in aarch64-linux. A visitor is implemented for displaced stepping, and used to record information to fixup pc after displaced stepping if needed. Some emit_* functions are converted to macros, and moved to arch/aarch64-insn.{c,h} so that they can be shared. gdb: 2015-10-12 Yao Qi <yao.qi@linaro.org> * aarch64-linux-tdep.c: Include arch-utils.h. (aarch64_linux_init_abi): Call set_gdbarch_max_insn_length, set_gdbarch_displaced_step_copy_insn, set_gdbarch_displaced_step_fixup, set_gdbarch_displaced_step_free_closure, set_gdbarch_displaced_step_location, and set_gdbarch_displaced_step_hw_singlestep. * aarch64-tdep.c (struct displaced_step_closure): New. (struct aarch64_displaced_step_data): New. (aarch64_displaced_step_b): New function. (aarch64_displaced_step_b_cond): Likewise. (aarch64_register): Likewise. (aarch64_displaced_step_cb): Likewise. (aarch64_displaced_step_tb): Likewise. (aarch64_displaced_step_adr): Likewise. (aarch64_displaced_step_ldr_literal): Likewise. (aarch64_displaced_step_others): Likewise. (aarch64_displaced_step_copy_insn): Likewise. (aarch64_displaced_step_fixup): Likewise. (aarch64_displaced_step_hw_singlestep): Likewise. * aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): New macro. (aarch64_displaced_step_copy_insn): Declare. (aarch64_displaced_step_fixup): Declare. (aarch64_displaced_step_hw_singlestep): Declare. * arch/aarch64-insn.c (emit_insn): Moved from gdbserver/linux-aarch64-low.c. (emit_load_store): Likewise. * arch/aarch64-insn.h (enum aarch64_opcodes): Moved from gdbserver/linux-aarch64-low.c. (struct aarch64_register): Likewise. (struct aarch64_memory_operand): Likewise. (ENCODE): Likewise. (can_encode_int32): New macro. (emit_b, emit_bcond, emit_cb, emit_ldr, emit_ldrsw): Likewise. (emit_tb, emit_nop): Likewise. (emit_insn): Declare. (emit_load_store): Declare. gdb/gdbserver: 2015-10-12 Yao Qi <yao.qi@linaro.org> * linux-aarch64-low.c (enum aarch64_opcodes): Move to arch/aarch64-insn.h. (struct aarch64_memory_operand): Likewise. (ENCODE): Likewise. (emit_insn): Move to arch/aarch64-insn.c. (emit_b, emit_bcond, emit_cb, emit_tb): Remove. (emit_load_store): Move to arch/aarch64-insn.c. (emit_ldr, emit_ldrb, emit_ldrsw, emit_nop): Remove. (can_encode_int32): Remove.
2015-05-26Implements aarch64 process record and reverse debugging supportOmair Javaid1-0/+6
This patch adds the support of aarch64-linux process record and reverse debugging. The implementation is similar to ARM's counterpart. 2015-05-26 Omair Javaid <omair.javaid@linaro.org> Yao Qi <yao.qi@linaro.org> * aarch64-linux-tdep.c: Include linux-record.h and record-full.h. (struct linux_record_tdep aarch64_linux_record_tdep): Declare. (aarch64_syscall): New enum. (aarch64_canonicalize_syscall): New function. (aarch64_all_but_pc_registers_record): New function. (aarch64_linux_syscall_record): New function. (aarch64_linux_init_abi): Install AArch64 process record handler. Update to handle syscall recording. * aarch64-tdep.c: Include record.h and record-full.h. (submask, bit, bits, REG_ALLOC, MEM_ALLOC): New macros. (struct aarch64_mem_r): Define. (aarch64_record_result): New enum. (struct insn_decode_record): Define. (insn_decode_record): New typedef. (aarch64_record_data_proc_reg): New function. (aarch64_record_data_proc_imm): New function. (aarch64_record_branch_except_sys): New function. (aarch64_record_load_store): New function. (aarch64_record_data_proc_simd_fp): New function. (aarch64_record_asimd_load_store): New function. (aarch64_record_decode_insn_handler): New function. (deallocate_reg_mem): New function. (aarch64_process_record): New function. * aarch64-tdep.h (struct gdbarch_tdep) <aarch64_syscall_record>: New field. (aarch64_process_record): New extern declaration. * configure.tgt: Add linux-record.o to gdb_target_obs. * linux-record.h (struct linux_record_tdep) <arg7>: New field.
2015-02-17Fix GDB build fail on Aarch64 when -fno-common is enabledMaxim Ostapenko1-0/+2
Current trunk GDB (and gdb-7.8.1 too) fails to build on Aarch64 when -fno-common is enabled. It fails during link stage due to multiple definition of `tdesc_aarch64': ... [ 199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64': [ 199s] /home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11: multiple definition of `tdesc_aarch64' [ 199s] aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540: first defined here [ 199s] aarch64-linux-nat.o: In function `initialize_tdesc_aarch64': [ 199s] /home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/features/aarch64.c:11: multiple definition of `tdesc_aarch64' [ 199s] aarch64-tdep.o:/home/abuild/rpmbuild/BUILD/gdb-7.8.1/gdb/objfiles.h:540: first defined here [ 199s] collect2: error: ld returned 1 exit status [ 199s] make[2]: *** [gdb] Error 1 ... This happens because struct target_desc *tdesc_aarch64 is defined in gdb/features/aarch64.c, which is included by two files (gdb/aarch64-linux-nat.c and gdb/aarch64-tdep.c). gdb/Changelog 2015-02-17 Max Ostapenko <m.ostapenko@partner.samsung.com> PR gdb/17984 * aarch64-linux-nat.c: Don't include features/aarch64.c anymore. (aarch64_linux_read_description): Remove initialize_tdesc_aarch64 call. * aarch64-tdep.h (tdesc_aarch64): Declare.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker1-1/+1
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-05-21AARCH64: Replace regset_alloc() invocations by static regset structures.Andreas Arnez1-4/+0
After removal of the regset_alloc invocations, the tdep fields 'gregset' and 'fpregset' become obsolete and are thus removed.
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker1-1/+1
2013-02-04Adding aarch64-linux-tdep support.Marcus Shawcroft1-0/+4
2013-02-04 Jim MacArthur <jim.macarthur@arm.com> Marcus Shawcroft <marcus.shawcroft@arm.com> Nigel Stephens <nigel.stephens@arm.com> Yufeng Zhang <yufeng.zhang@arm.com> * Makefile.in (ALL_64_TARGET_OBS): Add aarch64-linux-tdep.o. (ALLDEPFILES): Add aarch64-linux-tdep.c. * aarch64-linux-tdep.c: New file. * aarch64-linux-tdep.h: New file. * aarch64-tdep.h (gdbarch_tdep): Define gregset and fpregset. * configure.tgt: Add aarch64-none-linux-gnu.
2013-02-04Add basic support for AArch64.Marcus Shawcroft1-0/+93
* Makefile.in (ALL_64_TARGET_OBS): Add arch64-tdep.o. (HFILES_NO_SRCDIR): Add aarch64-tdep.h. (ALLDEPFILES): Add aarch64-tdep.c. * aarch64-tdep.c: New file. * aarch64-tdep.h: New file. * configure.tgt: Add AArch64. * features/Makefile (WHICH): Add aarch64 and aarch64-without-fpu. (aarch64-expedite): New definition. * features/aarch64-core.xml: New file. * features/aarch64-fpu.xml: New file. * features/aarch64-without-fpu.c: New file (generated). * features/aarch64-without-fpu.xml: New file. * features/aarch64.c: New file (generated). * features/aarch64.xml: New file. * regformats/aarch64-without-fpu.dat: New file (generated). * regformats/aarch64.dat: New file (generated).