This project is mirrored from https://sourceware.org/git/binutils-gdb.git. Pull mirroring updated .
  1. 27 Apr, 2021 2 commits
    • Luis Machado's avatar
      Remove stale test · c9601b7f
      Luis Machado authored
      This is an early test that was mistakenly pushed. Remove it.
      
      gdb/testsuite/ChangeLog:
      
      YYYY-MM-DD  Luis Machado  <luis.machado@arm.com>
      
      	* gdb.dwarf2/dw2-capability.exp: Remove file.
      c9601b7f
    • Luis Machado's avatar
      Support for passing/returning parameters · ad97a690
      Luis Machado authored
      This patch implements passing/returning of parameters for Morello.  It is
      implemented based on the Morello AAPCS64 document and supports both the hybrid
      AAPCS64 and Pure-Cap AAPCS64-CAP ABI's.
      
      gdb/ChangeLog
      
      2021-02-26  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (struct stack_item_t) <arg_value): New field.
      	(set_register_tag, pass_in_c, pass_in_c_or_stack,
      	pass_in_c_x_or_stack, type_fields_overlap_capabilities,
      	convert_pointer_to_capability,
      	morello_write_memory_with_capabilities,
      	morello_push_dummy_call, morello_extract_return_value,
      	morello_return_in_memory, morello_store_return_value,
      	morello_return_value): New functions.
      	(pass_in_x, pass_in_v, pass_on_stack, pass_in_x_or_stack,
      	pass_in_v_vfp_candidate): Update.
      	(aarch64_return_value): New argument value.
      	(aarch64_gdbarch_init): Conditionally set both gdbarch_push_dummy_call
      	and gdbarch_return_value.
      	* arch/aarch64.h (MORELLO_MEMORY_TAG_GRANULE_SIZE): New constant.
      	* dwarf2/read.c (handle_struct_member_die): Record whether the
      	composite type contains capabilities.
      	* gdbarch.sh (return_value): New argument value.
      	* gdbarch.c: Regenerate.
      	* gdbarch.h: Regenerate.
      	* gdbtypes.c (recursive_dump_type): Dump extra information.
      	(append_composite_type_field_raw): Set whether the composite type
      	constains capabilities.
      	* gdbtypes.h (struct main_type) <m_flag_contains_capability>: New field.
      	<contains_capability>: New member function.
      	<set_contains_capability>: New member function.
      
      	* alpha-tdep.c: Update return_value hook prototype.
      	* amd64-tdep.c: Update return_value hook prototype.
      	* amd64-windows-tdep.c: Update return_value hook prototype.
      	* arc-tdep.c: Update return_value hook prototype.
      	* arm-tdep.c: Update return_value hook prototype.
      	* avr-tdep.c: Update return_value hook prototype.
      	* bfin-tdep.c: Update return_value hook prototype.
      	* bpf-tdep.c: Update return_value hook prototype.
      	* cris-tdep.c: Update return_value hook prototype.
      	* csky-tdep.c: Update return_value hook prototype.
      	* elfread.c: Update return_value hook prototype.
      	* frv-tdep.c: Update return_value hook prototype.
      	* ft32-tdep.c: Update return_value hook prototype.
      	* h8300-tdep.c: Update return_value hook prototype.
      	* hppa-tdep.c: Update return_value hook prototype.
      	* i386-tdep.c: Update return_value hook prototype.
      	* ia64-tdep.c: Update return_value hook prototype.
      	* infcall.c: Update return_value hook prototype.
      	* infcmd.c: Update return_value hook prototype.
      	* lm32-tdep.c: Update return_value hook prototype.
      	* m32c-tdep.c: Update return_value hook prototype.
      	* m32r-tdep.c: Update return_value hook prototype.
      	* m68hc11-tdep.c: Update return_value hook prototype.
      	* m68k-tdep.c: Update return_value hook prototype.
      	* mep-tdep.c: Update return_value hook prototype.
      	* microblaze-tdep.c: Update return_value hook prototype.
      	* mips-tdep.c: Update return_value hook prototype.
      	* mn10300-tdep.c: Update return_value hook prototype.
      	* moxie-tdep.c: Update return_value hook prototype.
      	* msp430-tdep.c: Update return_value hook prototype.
      	* nds32-tdep.c: Update return_value hook prototype.
      	* nios2-tdep.c: Update return_value hook prototype.
      	* or1k-tdep.c: Update return_value hook prototype.
      	* ppc-fbsd-tdep.c: Update return_value hook prototype.
      	* ppc-linux-tdep.c: Update return_value hook prototype.
      	* ppc-netbsd-tdep.c: Update return_value hook prototype.
      	* ppc-sysv-tdep.c: Update return_value hook prototype.
      	* riscv-tdep.c: Update return_value hook prototype.
      	* rl78-tdep.c: Update return_value hook prototype.
      	* rs6000-aix-tdep.c: Update return_value hook prototype.
      	* rs6000-lynx178-tdep.c: Update return_value hook prototype.
      	* rx-tdep.c: Update return_value hook prototype.
      	* s12z-tdep.c: Update return_value hook prototype.
      	* s390-tdep.c: Update return_value hook prototype.
      	* score-tdep.c: Update return_value hook prototype.
      	* sh-tdep.c: Update return_value hook prototype.
      	* sparc-tdep.c: Update return_value hook prototype.
      	* sparc64-tdep.c: Update return_value hook prototype.
      	* stack.c: Update return_value hook prototype.
      	* tic6x-tdep.c: Update return_value hook prototype.
      	* tilegx-tdep.c: Update return_value hook prototype.
      	* v850-tdep.c: Update return_value hook prototype.
      	* valprint.c: Update return_value hook prototype.
      	* value.c: Update return_value hook prototype.
      	* vax-tdep.c: Update return_value hook prototype.
      	* xstormy16-tdep.c: Update return_value hook prototype.
      	* xtensa-tdep.c: Update return_value hook prototype.
      ad97a690
  2. 17 Mar, 2021 3 commits
    • Luis Machado's avatar
      Enable capability writes to memory · 610f2481
      Luis Machado authored
      Enable writing/forging capabilities to memory via the PTRACE_POKECAP ptrace
      request.  This patch enables both GDB and gdbserver for Morello.
      
      For remote writes, we use the qXfer:capa:write packet.
      
      gdb/ChangeLog:
      
      2021-03-17  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-linux-nat.c (aarch64_linux_nat_target)
      	<write_capability>: New member function override.
      	(aarch64_linux_nat_target::write_capability): New member
      	function.
      	(maint_print_cap_from_addr_cmd): Adjust printing format.
      	(maint_set_capability_in_memory_cmd): New maintenance function.
      	(add_show_debug_regs_command): Register new maintenance command.
      	* nat/aarch64-cap-linux.c (aarch64_linux_write_capability): New
      	function.
      	* nat/aarch64-cap-linux.h (aarch64_linux_write_capability): New
      	prototype.
      	* remote.c (remote_target)
      	<write_capability>: New member function override.
      	Adjust enum documentation for PACKET_qXfer_capability.
      	(remote_target::write_capability): New member function.
      	(_initialize_rem...
      610f2481
    • Luis Machado's avatar
      Fix extracting tags from PCC and CSP · 4e3136f3
      Luis Machado authored
      The tags for PCC/CSP are stored in the order of struct user_morello_state.
      
      Make sure we account for that when extracting the tags.
      
      gdb/ChangeLog:
      
      2021-03-17  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_register_tag): Handle PCC/CSP tag
      	extraction.
      4e3136f3
    • Luis Machado's avatar
      Fix disassembly of C64 instructions in GDB · c900c916
      Luis Machado authored
      Disassembling of C64 instructions in GDB does not work correctly. It needs
      to pass the proper information to opcodes.
      
      This patch accomplishes that.
      
      gdb/ChangeLog:
      
      2021-03-17  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_find_mapping_symbol, aarch64_pc_is_c64): New
      	functions.
      	(aarch64_gdb_print_insn): Pass map type to disassembler.
      
      include/ChangeLog:
      
      2021-03-17  Luis Machado  <luis.machado@arm.com>
      
      	* opcode/aarch64.h (enum map_type): Moved from opcodes/aarch64-dis.c.
      	Renamed fields.
      	(struct aarch64_private_data): New struct.
      
      opcodes/ChangeLog:
      
      2021-03-17  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-dis.c (enum map_type): Moved to include/opcode/aarch64.h.
      	(MAYBE_C64): Adjust.
      	(get_sym_code_type): Adjust.
      	(print_insn_aarch64): Use private data when available.
      c900c916
  3. 15 Jan, 2021 9 commits
    • Luis Machado's avatar
      Enable Morello register set writes · f5f4a6b0
      Luis Machado authored
      Make the Morello register set writable, so GDB can write to the C registers
      and forge capabilities.
      
      To enable write access to the registers, the cheri.ptrace_forge_cap sysctl
      option must be toggled.
      
      gdb/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-linux-nat.c (store_cregs_to_thread): Implement.
      	(aarch64_linux_nat_target::store_registers): Don't fetch the C
      	registers before writing to them.
      	Fetch GPR's after modifying the C registers.
      	* aarch64-tdep.c (aarch64_cannot_store_register): Remove C registers
      	write restriction.
      	* regcache.c (regcache_write_pc): Handle partial writes to PCC.
      
      gdbserver/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* linux-aarch64-low.cc (aarch64_fill_cregset): New function.
      	(aarch64_regsets, aarch64_sve_regsets): Add C registers fill hook.
      f5f4a6b0
    • Luis Machado's avatar
      Remove spurious newline in fault message · 206353a7
      Luis Machado authored
      gdb/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-linux-tdep.c (aarch64_linux_report_signal_info): Remove
      	spurious newline output.
      206353a7
    • Luis Machado's avatar
      Read capability tags from memory · c7c3ac5d
      Luis Machado authored
      This patch enables capability reads from memory, including the tag bit.
      
      It enables both native GDB and gdbserver to do so.
      
      gdb/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-linux-nat.c (aarch64_linux_nat_target)
      	<read_capability>: New function override.
      	(aarch64_linux_nat_target::read_capability): New function.
      	(maint_print_cap_from_addr_cmd): New function.
      	(add_show_debug_regs_command): Register new maintenance command.
      	* aarch64-linux-tdep.c: Include target.h.
      	(aarch64_linux_get_cap_tag_from_address): New function.
      	(aarch64_linux_init_abi): Register hook for
      	gdbarch_get_cap_tag_from_address
      	* arch-utils.c (default_get_cap_tag_from_address): New function.
      	* arch-utils.h (default_get_cap_tag_from_address): New prototype.
      	* configure.nat: Add nat/aarch64-cap-linux.o to the list of object
      	files for AArch64-Linux.
      	* gdbarch.c: Regenerate.
      	* gdbarch.h: Regenerate.
      	* gdbarch.sh (get_cap_tag_from_address): New gdbarch hook.
      	* nat/aarch64-cap-linux.c: New file.
      	* nat/aarch64-cap-linux.h (aarch64_linux_read_capability): New
      	prototype.
      	* remote.c (remote_target) <read_capability>: New function override.
      	(PACKET_qXfer_capability): New enum.
      	(remote_target::xfer_partial): Handle TARGET_OBJECT_CAPABILITY.
      	(remote_target::read_capability): New member function.
      	(_initialize_remote): Add new packet configuration.
      	* target-delegates.c: Regenerate.
      	* target.c (target_read_capability): New function.
      	* target.h (target_object) <TARGET_OBJECT_CAPABILITY>: New enum field.
      	(struct target_ops) <read_capability>: New virtual member function.
      	(target_read_capability): New prototype.
      	* valprint.c (generic_value_print_capability): Handle tags from
      	capabilities stored in memory.
      	* value.c (value_fetch_lazy_memory): Fetch tag if reading a capability.
      
      gdbserver/ChangeLog
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* configure.srv: Add nat/aarch64-cap-linux.o to the list of object
      	files for AArch64-Linux
      	* linux-aarch64-low.cc (aarch64_target) <supports_qxfer_capability>
      	<qxfer_capability>: New member function overrides.
      	(aarch64_target::supports_qxfer_capability): New function.
      	(aarch64_target::qxfer_capability): New function.
      	* server.cc (handle_qxfer_capability): New function.
      	(qxfer_packets): Add "capa" packet.
      	* target.cc (process_stratum_target::supports_qxfer_capability)
      	(process_stratum_target::qxfer_capability): New functions.
      	* target.h (process_stratum_target) <supports_qxfer_capability>
      	<qxfer_capability>: New virtual member functions.
      c7c3ac5d
    • Luis Machado's avatar
      Handle unavailable LR/PC · d2746b65
      Luis Machado authored
      This fixes a situation where LR/PC is not available, so we need to throw
      an error rather than continuing.
      
      gdb/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_prologue_prev_register)
      	(aarch64_dwarf2_prev_register): Throw error if LR is optimized out.
      d2746b65
    • Luis Machado's avatar
      Add PTRACE_POKECAP request and move things to a Morello-specific file · a3eae5be
      Luis Machado authored
      gdb/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* Makefile.in (HFILES_NO_SRCDIR): Add nat/aarch64-cap-linux.h.
      	* aarch64-linux-nat.c: Include nat/aarch64-cap-linux.h.
      	* nat/aarch64-cap-linux.h: New file.
      	* nat/aarch64-linux.h (struct user_morello_state): Move to
      	nat/aarch64-cap-linux.h.
      
      gdbserver/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* linux-aarch64-low.cc: Include nat/aarch64-cap-linux.h.
      a3eae5be
    • Luis Machado's avatar
      Fix include file define. · 2243afcc
      Luis Machado authored
      gdb/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* arch/aarch64-cap-linux.h: Fix define name.
      2243afcc
    • Luis Machado's avatar
      Adjust testcase for new CHERI printing option · 2d13fda6
      Luis Machado authored
      gdb/testsuite/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* gdb.base/options.exp: Add -compact-capabilities option.
      2d13fda6
    • Luis Machado's avatar
      Don't show extra __capability modifier · feb7ecf3
      Luis Machado authored
      gdb/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_address_class_type_flags_to_name): Return
      	NULL.
      feb7ecf3
    • Luis Machado's avatar
      Don't print parenthesis if there are no capability attributes · de9f6060
      Luis Machado authored
      gdbsupport/ChangeLog:
      
      2021-01-15  Luis Machado  <luis.machado@arm.com>
      
      	capability.cc (capability::to_str): Don't print parenthesis if there
      	are no attributes.
      de9f6060
  4. 30 Dec, 2020 4 commits
    • Luis Machado's avatar
      Fix compact printing format and sealed check · a2d62a17
      Luis Machado authored
      Fix some erroneous interpretation of sealed capabilities and adjust the
      code to print capability attributes correctly.
      
      gdbsupport/ChangeLog:
      
      2020-12-30  Luis Machado  <luis.machado@arm.com>
      
      	* capability.cc (capability::to_str): Fix compact printing
      	format and documentation.
      	* capability.h (capability::is_sealed): Fix wrong check.
      a2d62a17
    • Luis Machado's avatar
      Fix attribute printing bug · 91aee486
      Luis Machado authored
      We just reset the attribute string instead of appending to it.  This patch
      fixes this.
      
      gdbsupport/ChangeLog:
      
      2020-12-30  Luis Machado  <luis.machado@arm.com>
      
      	* capability.cc (capability::to_str): Append strings to
      	attribute string.
      91aee486
    • Luis Machado's avatar
      Fix incorrect length for capabilities · f73f0857
      Luis Machado authored
      The length used to include the tag, but now it doesn't.  This fixes it.
      
      gdb/ChangeLog:
      
      2020-12-30  Luis Machado  <luis.machado@arm.com>
      
      	* valprint.c (generic_value_print_capability): Don't add 1 to
      	the capability length.
      f73f0857
    • Luis Machado's avatar
      Add switch to control compact/verbose printing of capabilities · cb40fb0a
      Luis Machado authored
      Add a new option set/show "print compact-capabilities" that default to "on".
      
      This makes GDB default to printing capabilities in compact format, the CHERI
      format.
      
      gdb/ChangeLog:
      
      2020-12-30  Luis Machado  <luis.machado@arm.com>
      
      	* valprint.c (user_print_options): Initialize compact_capabilities.
      	(show_print_compact_capabilities): New function.
      	(generic_value_print_capability): Use compact_capabilities option.
      	(value_print_option_defs): New compact_capabilities option.
      	* valprint.h (value_print_options) <compact_capabilities>: New member
      	variable.
      cb40fb0a
  5. 16 Dec, 2020 1 commit
    • Luis Machado's avatar
      CHERI-style compact printing format · e6d8fe43
      Luis Machado authored
      This patch adds CHERI-style compact printing format to GDB and uses it
      by default.
      
      The format is described here: https://github.com/CTSRD-CHERI/cheri-c-programming/wiki/Displaying-Capabilities
      
      gdbsupport/ChangeLog:
      
      2020-12-16  Luis Machado  <luis.machado@arm.com>
      
      	* capability.cc (cap_short_perms_strings): Remove.
      	(capability::is_null_derived): New member function.
      	(capability::to_str): Document and handle new CHERY-style printing
      	format.
      	* capability.h (cap_constants): Document the CAP_SEAL_TYPE_*
      	constants.
      	(struct capability) <is_null_derived>: New member function prototype.
      e6d8fe43
  6. 08 Dec, 2020 9 commits
    • Luis Machado's avatar
      Use CLR DWARF register and PCC/CSP · c03396af
      Luis Machado authored
      Remove code to return LR for a CLR DWARF register.
      
      For the pure capability ABI, set pc to PCC and sp to CSP.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_dwarf_reg_to_regnum): Don't return LR
      	for CLR.
      	(aarch64_gdbarch_init): Set pc to PCC and sp to CSP for pure cap
      	ABI.
      c03396af
    • Luis Machado's avatar
      Print capability pointers as capabilities · 6dca7616
      Luis Machado authored
      Print capability pointers as capabilities, so the user can see the
      decoded fields of the capability.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* c-valprint.c (c_value_print_ptr): Adjust to print capability
      	pointers as capabilities.
      	(c_value_print_inner): Handle TYPE_CODE_CAPABILITY.
      	* findvar.c (extract_integer): Truncate scalars instead of erroring out.
      	* valprint.c (generic_value_print_capability): Make non-static and
      	print additional space.
      	* valprint.h (generic_value_print_capability): New prototype.
      6dca7616
    • Luis Machado's avatar
      Print shorter version of decoded capabilities · dcbd343a
      Luis Machado authored
      In order to produce output that is not so verbose, we print the short version
      of the decoded capabilities instead.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* valprint.c (generic_value_print_capability): Use compact form.
      
      gdbsupport/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* capability.cc (cap_short_perms_strings): New static global.
      	(capability::to_str): New argument COMPACT. Print contents based
      	on the new argument.
      	(capability::print): Update calls.
      	* capability.h (capability::to_str): Update prototype and
      	documentation.
      dcbd343a
    • Luis Machado's avatar
      Adjust capability string for printing · d3f6d232
      Luis Machado authored
      Rename "attributes" to "permissions" when printing decoded capabilities.
      
      gdbsupport/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* capability.cc (capability::to_str): Rename "attributes" to
      	"permissions".
      d3f6d232
    • Luis Machado's avatar
      Support casting capabilities/capability pointers to other types · 24ba75a5
      Luis Machado authored
      When casting capabilities and capability pointers to other types, we truncate
      the value to the appropriate size, given some capabilities are greater than
      8 bytes in size.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* valops.c (value_cast): Handle casting from capabilities and
      	capability pointers.
      24ba75a5
    • Luis Machado's avatar
      Support data_capability and code_capability types + update target description · 295ea638
      Luis Machado authored
      Support the data_capability and code_capability types, which the capability
      counterparts of the data_ptr and code_ptr types.
      
      Adjust the Morello C registers to be of data_capability and code_capability
      types.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_address_class_type_flags)
      	(aarch64_address_class_type_flags_to_name)
      	(aarch64_address_class_name_to_type_flags): Use
      	TYPE_INSTANCE_FLAG_CAPABILITY instead of
      	TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1.
      	(aarch64_gdbarch_init): Set capability size to 128.
      	* features/aarch64-capability.c: Regenerate.
      	* features/aarch64-capability.xml: Update C register types.
      	* gdbarch.c: Regenerate.
      	* gdbarch.h: Regenerate.
      	* gdbarch.sh (code_capability_bit, data_capability)
      	(dwarf2_capability_size): Remove.
      	* gdbtypes.c (gdbtypes_post_init): Initialize data_capability and
      	code_capability types.
      	* gdbtypes.h (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): Include
      	TYPE_INSTANCE_FLAG_CAPABILITY in the list of address classes.
      	(struct builtin_type) <builtin_data_addr_capability>: Rename to
      	builtin_data_capability.
      	(struct builtin_type) <builtin_code_addr_capability>: Rename to
      	builtin_code_capability.
      	* target-descriptions.c (make_gdb_type): Update type names.
      
      gdbsupport/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* tdesc.cc (tdesc_predefined_types): Update type names for
      	capabilities.
      295ea638
    • Luis Machado's avatar
      Don't ignore pointer sizes when printing · f49d244a
      Luis Machado authored
      When displaying a capability pointer, don't truncate the length of the type.
      
      Also, update the instance flags to mark capability pointers as
      TYPE_INSTANCE_FLAG_CAPABILITY.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_address_class_type_flags)
      	(aarch64_address_class_type_flags_to_name)
      	(aarch64_address_class_name_to_type_flags): Use
      	TYPE_INSTANCE_FLAG_CAPABILITY instead of
      	TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1.
      	* gdbtypes.h (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): Include
      	TYPE_INSTANCE_FLAG_CAPABILITY.
      	* printcmd.c (print_scalar_formatted): Don't truncate capability
      	pointers.
      f49d244a
    • Luis Machado's avatar
      Invert CSP/PCC and simplify access to C register numbers · ee871849
      Luis Machado authored
      This change makes the code more straightforward, since we can expect the order
      of the X registers to match that of the C registers.  That way we don't have to
      deal with ordering issues.
      
      It also simplifies the access to the dynamic C register numbers through the
      gdbarch tdep data structure.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-linux-nat.c (fetch_cregs_from_thread): Invert pcc/csp
      	order.
      	* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Likewise.
      	* aarch64-tdep.c (aarch64_c_register_names): Likewise.
      	(aarch64_analyze_prologue): Remove code to handle csp/pcc ordering
      	issues.
      	(aarch64_prologue_prev_register): Use new tdep fields.
      	(aarch64_dwarf2_prev_register): Use new tdep fields and handle lr/clr.
      	(aarch64_dwarf2_frame_init_reg): Use new tdep fields.
      	(aarch64_gdbarch_init): Initialize the new tdep fields.
      	* aarch64-tdep.h (gdbarch_tdep) <cap_reg_clr, cap_reg_csp>
      	<cap_reg_pcc, cap_reg_rcsp>: New fields
      	* features/aarch64-capability.c: Regenerate.
      	* features/aarch64-capability.xml: Invert pcc/csp.
      
      gdbserver/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* linux-aarch64-low.cc (aarch64_store_cregset): Invert pcc/csp.
      ee871849
    • Luis Machado's avatar
      Guard places using Morello C registers · 02ff4fb4
      Luis Machado authored
      Make sure we only use the C registers if they have been detected.
      
      gdb/ChangeLog:
      
      2020-11-11  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_prologue_prev_register): Guard use of
      	C registers.
      	(aarch64_dwarf2_prev_register): Likewise.
      	(aarch64_dwarf2_frame_init_reg): Likewise.
      	* aarch64-linux-nat.c
      	(aarch64_linux_nat_target::store_registers): Likewise.
      02ff4fb4
  7. 29 Oct, 2020 1 commit
  8. 20 Oct, 2020 11 commits
    • Luis Machado's avatar
      [Morello] Add iclass to add/sub instructions · cc7013e8
      Luis Machado authored
      Add the proper iclass to add/sub so code relying on instruction
      decoding can extract precise information.
      
      opcodes/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tbl.h (aarch64_opcode_table): Update iclass field
      	for add/sub
      cc7013e8
    • Luis Machado's avatar
      [Morello] Add preliminary core file register set support · c778c6aa
      Luis Machado authored
      Add the register set that is going to be used to read core file data.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-linux-tdep.c (aarch64_linux_cregmap)
      	(aarch64_linux_cregset): New structs.
      	(aarch64_linux_iterate_over_regset_sections): Check for capability
      	registers.
      	(aarch64_linux_init_abi): Initialize C register set numbers.
      c778c6aa
    • Luis Machado's avatar
      [Morello] Fixup manual unwinding without DWARF · db4f31a2
      Luis Machado authored
      Given the use of C registers implies we now have to store 16 bytes worth of
      data instead of 8 bytes, we need to adjust the code that handles tracking
      register motion and register saving to the stack.
      
      FIXME-Morello: This patch requires changes to opcodes/aarch64-tbl.h so the
      a64c instructions carry the proper iclass and opcode information.
      
      Right now, some of the a64c instructions don't carry enough information for
      the prologue analyzer to distinguish/group them.
      
      This patch also adds more debugging output.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_analyze_prologue): Handle C registers and
      	a64c instructions.
      	(aarch64_scan_prologue): Add debugging output.
      	* prologue-value.c (pv_area::find_reg): Don't match the register size
      	exactly, but check if the area size is at least the size of a register.
      db4f31a2
    • Luis Machado's avatar
      [Morello] Unwinding: Restore CLR and PCC properly · 9e9a064b
      Luis Machado authored
      This patch teaches GDB how to handle restoring CLR and PCC values properly.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_prologue_prev_register): Use LR or CLR
      	depending on the request.
      	(aarch64_dwarf_reg_to_regnum): Redirect CLR to LR temporarily.
      	* aarch64-tdep.h (AARCH64_DWARF_CLR): New constant.
      9e9a064b
    • Luis Machado's avatar
      [Morello] Enable DWARF unwinding with C registers · e862249e
      Luis Machado authored
      Adjust unwinding functions to cope with the presence of C registers.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_prologue_prev_register): Handle the PCC and
      	CSP registers. Remove the LSB.
      	(aarch64_dwarf2_prev_register): Handle CSP, PCC and remove the LSB
      	from CLR.
      	(aarch64_dwarf2_frame_init_reg): Handle PCC and CSP.
      	(aarch64_dwarf_reg_to_regnum): Handle C registers.
      e862249e
    • Luis Machado's avatar
      [Morello] Add 'C' augmentation character support · b34767fc
      Luis Machado authored
      Handle the Morello 'C' augmentation character. It is not used yet, but it
      is acknowledged.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* dwarf2/frame.c (struct dwarf2_cie) <pure_cap>: New field.
      	(decode_frame_entry_1): Handle the 'C' augmentation character.
      b34767fc
    • Luis Machado's avatar
      [General/Morello] Fetch and display register capability tags correctly · 32487f77
      Luis Machado authored
      This patch teaches GDB how to print the capability tag from registers.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_register_has_tag, aarch64_register_tag): New
      	functions.
      	(aarch64_gdbarch_init): Register hooks.
      	* arch-utils.c (default_register_has_tag, default_register_tag): New
      	functions.
      	* arch-utils.h (default_register_has_tag, default_register_tag): New
      	prototypes.
      	* gdbarch.c: Regenerate.
      	* gdbarch.h: Likewise.
      	* gdbarch.sh (register_has_tag, register_tag): New gdbarch hooks.
      	* regcache.c (readable_regcache::cooked_read_value): Fetch the tag
      	metadata from registers.
      	* valprint.c (generic_value_print_capability): Display register tags.
      	* value.c (struct value) <tagged, tag>: New fields.
      	(value_contents_copy_raw): Handle tags.
      	(value_tagged, set_value_tagged, value_tag, set_value_tag): New
      	functions.
      	(value_copy): Handle tags.
      	* value.h (value_tagged, set_value_tagged, value_tag)
      	(set_value_tag): New prototypes.
      32487f77
    • Luis Machado's avatar
      [Morello] Record mapping symbols and mark C64 function symbols as special · 837afe9d
      Luis Machado authored
      This patch teaches GDB about AArch64 mapping symbols and special minimal
      symbols.
      
      FIXME-Morello: This is currently not actively used, but will be used to detect
      capability mode functions later.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c: Include elf-bfd.h.
      	(MSYMBOL_SET_SPECIAL, MSYMBOL_IS_SPECIAL): New constants.
      	(aarch64_mapping_symbol): New struct.
      	(aarch64_mapping_symbol_vec): New typedef.
      	(aarch64_per_bfd): New struct.
      	(aarch64_bfd_data_key): New static global.
      	(aarch64_elf_make_msymbol_special, +aarch64_record_special_symbol): New
      	function.
      	(aarch64_gdbarch_init): Register hooks.
      837afe9d
    • Luis Machado's avatar
      [Morello] Add static ABI detection based on the __cap_relocs section · 69552c42
      Luis Machado authored
      This patch attempts to detect if we are loading a capability-enabled symbol
      file or not, so we can set the proper hooks.
      
      FIXME-Morello: This still needs formalization in the ABI document.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_bfd_has_capabilities): New function.
      	(aarch64_gdbarch_init): Do static ABI check.
      69552c42
    • Luis Machado's avatar
      [Morello] Add register aliases for Morello (cfp, clr, c31, cip0 and cip1) · d54450eb
      Luis Machado authored
      This patch adds cfp, clr, c31, cip0 and cip1, aliased to c29, c30, c31, c16 and
      c17.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-tdep.c (aarch64_morello_register_aliases): New static global.
      	(aarch64_gdbarch_init): Initialize alias registers.
      d54450eb
    • Luis Machado's avatar
      [Morello] Disable displaced stepping for Morello · 41f42a0b
      Luis Machado authored
      Morello can't support displaced stepping at the moment given it has no API
      to write capabilities, which is needed when GDB needs to adjust the X and C
      registers during a displaced stepping operation.
      
      gdb/ChangeLog:
      
      2020-10-20  Luis Machado  <luis.machado@arm.com>
      
      	* aarch64-linux-tdep.c (aarch64_linux_init_abi): Only set displaced
      	stepping hooks for non-Morello targets.
      41f42a0b