Age | Commit message (Collapse) | Author | Files | Lines |
|
Add simple handling of capability function arguments (also used for
return values) and update riscv_return_value to propagate tags.
|
|
|
|
|
|
For purecap this isn't always set by DWARF attributes, and in particular
it isn't for CHERI-RISC-V.
|
|
In the XML target descriptions, registers can be given a type of
"code_ptr" or "data_ptr". GDB always uses the builtin type for "void
*" for these registers. However, this is wrong if the register's size
does not match (e.g. the legacy "sp" and "pc" ARM64 registers when
using a purecap binary for which "void *" is a capability). If the
sizes don't match, try to find a matching type such as "long" or
"intcap_t" to use instead.
|
|
- Add CHERI to the RISC-V ISA features if an ELF file contains the
"xcheri" attribute. This is set in both hybrid and purecap
ELF files. This isn't needed for purecap ELF files but does enable
capability types and the "__capability" keyword on hybrid
binaries and libraries.
- Add address_class gdbarch methods so that capability pointer types
are tagged as capabilities in hybrid binaries. This is a bit gross.
Ideally riscv_address_class_type_flags would only enable the
TYPE_INSTANCE_FLAG_CAPABILITY if the passed in byte_size (from
DW_ATTR_byte_size) was equal to riscv_isa_clen() (aka
gdbarch_capability_bit()). However, for some reason this gdbarch
method doesn't take the gdbarch member. For now, rely on the fact
that it is only called if either there is a DW_ATTR_address_space
attribute on a pointer, or if the byte_size doesn't match the
default pointer size. Assuming there is no DW_ATTR_address_space
defined for RISC-V yet, this means it should only be called for a
size mismatch, and since we don't allow creating integer pointers in
purecap, this means it can only be called for capability pointers
for hybrid binaries.
|
|
This supports both the compact format (always used for annotating
pointer variables) and the verbose format (available via set print
compact-capabilities off) when displaying individual capabilities.
|
|
gdb/cheri-compressed-cap
subrepo:
subdir: "gdb/cheri-compressed-cap"
merged: "6762a19ba9f"
upstream:
origin: "https://github.com/CTSRD-CHERI/cheri-compressed-cap"
branch: "master"
commit: "6762a19ba9f"
git-subrepo:
version: "0.4.3"
origin: "???"
commit: "???"
|
|
|
|
|
|
- Register maps and sets for the capability register set and support
for them in core dumps.
- A CheriABI signal frame unwinder.
- Support CheriABI when fetching the address of TLS variables.
- Extend fbsd_report_signal_info for CHERI exceptions to give the
name of the relevant capability register.
|
|
|
|
|
|
|
|
This fixes stepping into some functions in purecap.
|
|
|
|
Co-authored-by: John Baldwin <jhb@FreeBSD.org>
|
|
Co-authored-by: John Baldwin <jhb@FreeBSD.org>
|
|
Add a separate table of capmode instructions and change
riscv_disassemble_insn to look for a match in this table first when
using capmode. If a match isn't found, fall back to the normal table.
Capmode is currently enabled for any ELF file which has the capmode
flag set in the ELF header flags.
|
|
This does not yet handle capability mode.
|
|
Use a boolean to determine if a version is present (similar to
what is done in riscv_parse_prefixed_ext) rather than assuming
that both versions set to 0 means no version was present.
This fixes parsing of an attribute string of
"rv64i2p0_m2p0_a2p0_f2p0_d2p0_c2p0_xcheri0p0" which previously failed
with the error:
BFD: x ISA extension `xcheri' must be set with the versions
|
|
|
|
This locates the relevant memtag.cheri section to fetch the tag and
uses target_read_memory to fetch the rest of the capability's
contents.
|
|
This permits callers to search for other memory tag section types.
|
|
These methods are no longer used as core GDB code now reads and
writes capabilities atomically.
|
|
This is similar to the support for MTE core dump segments.
|
|
TYPE_CODE_CAPABILITY is used for intcap_t and uintcap_t, whereas
capability-sized pointers use TYPE_CODE_PTR with the TYPE_CAPABILITY
flag. This avoids trying to indirect scalar capability values in
some places. Cosmetically it stops the output of the '(intcap_t)'
prefixes in front of capability values.
|
|
uintcap_t/intcap_t types don't have TYPE_CAPABILITY set, only pointer
types have this flag set.
|
|
value_primitive_field copies the subrange of a non-lazy value into
the new value for a subobject. However, the value of outer objects
never contain tags. Instead, always mark new values as lazy if they
are a capability or are a structure containing a capability member.
|
|
- For the address ('a') size, pick a suitable size corresponding to
ptraddr_t for pure capability ABIs.
- Add a new 'C' size flag that prints memory as capabilities, either in
the default compact format, or as hex via 'x'. The hex format does not
yet include tags.
|
|
|
|
|
|
This allows testing for 0 to distinguish architectures without
capabilities. Make use of this to only add in builtin types for
architectures which support capabilities.
|
|
Use target_write_capability to write a capability atomically in
put_frame_register.
|
|
When resolving a lazy memory capability value, use
target_read_capability to read the entire capability directly rather
than only using it to read the tag. Also, just use
target_read_capability directly without requiring a gdbarch wrapper
method.
|
|
|
|
This is a bit of a hack, but it allows you to override the initial
path to the runtime linker instead of having GDB always trust the
contents of .interp. This is useful for running purecap binaries
under a hybrid world or vice versa via 'run'.
|
|
|
|
This uses custom collect/supply regset handlers which pass the TLS
register number from the gdbarch_tdep as the base register number.
|
|
This is similar to have_regset but is used for older register sets that
pre-date PT_GETREGSET and use separate fetch and store ptrace operations.
|
|
|
|
|
|
|
|
This returns a string of just the metadata for a capability.
capability::to_str uses this method when outputting the compact form.
|
|
For pointers, use gdbarch_print_cap_attributes after printing the
pointer's address normally.
For printing a raw capability, use gdbarch_print_cap.
I removed the fetch of the tag from memory explicitly in
generic_value_print_capability as it should already be fetched for
memory values in value_fetch_lazy_memory.
|
|
gdbarch_print_cap prints a full capability in either verbose or
compat forms.
gdbarch_print_cap_attributes prints just the metadata such as bounds
and permissions of a capability without the address.
|
|
- Register set for NT_CAPREGS.
- Signal frame unwinder.
- Use CTPIDR instead of TPIDR to find the TCB for purecap when
resolving TLS variables.
|
|
|
|
In particular, use the smaller of address or pointer bit count to determine
the size of the address field.
|
|
- Treat dyn_ptr members of .dynamic entries as addresses rather than
pointers.
- Don't truncate pointers in svr4_truncate_ptr() if the pointer size is
larger than a CORE_ADDR as the truncation effectively sets them to
zero in this case. This should perhaps be using
gdbarch_integer_to_address() instead of it's own explicit truncation
anyway.
|