From: Luis Machado Date: Mon, 19 Oct 2020 21:46:49 +0000 (-0300) Subject: [Morello] Add preliminary core file register set support X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c778c6aa016d691f4ab8e2781d52ef9cf77c1f60;p=thirdparty%2Fbinutils-gdb.git [Morello] Add preliminary core file register set support Add the register set that is going to be used to read core file data. gdb/ChangeLog: 2020-10-20 Luis Machado * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 00788bb0dcb..ea5db55410d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2020-10-20 Luis Machado + + * 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. + 2020-10-20 Luis Machado * aarch64-tdep.c (aarch64_analyze_prologue): Handle C registers and diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 70b2224a0f0..398b429341d 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -474,6 +474,20 @@ static const struct regcache_map_entry aarch64_linux_fpregmap[] = { 0 } }; +/* Since the C register numbers are determined dynamically, we leave + placeholders so we can update the numbers later. */ +static struct regcache_map_entry aarch64_linux_cregmap[] = + { + /* FIXME-Morello: Need to decide if we are reading the whole 16 bytes or + just the upper 8 bytes of the capability registers. */ + { 31, -1, 8 }, /* c0 ... c30 */ + { 1, -1, 8 }, /* Stack Pointer Capability */ + { 1, -1, 8 }, /* Program Counter Capability */ + { 1, -1, 16 }, /* Default Data Capability */ + { 1, -1, 8 }, + { 0 } + }; + /* Register set definitions. */ const struct regset aarch64_linux_gregset = @@ -488,6 +502,13 @@ const struct regset aarch64_linux_fpregset = regcache_supply_regset, regcache_collect_regset }; +/* The capability register set. */ +const struct regset aarch64_linux_cregset = + { + aarch64_linux_cregmap, + regcache_supply_regset, regcache_collect_regset + }; + /* The fields in an SVE header at the start of a SVE regset. */ #define SVE_HEADER_SIZE_LENGTH 4 @@ -723,6 +744,15 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, AARCH64_LINUX_SIZEOF_PAUTH, &aarch64_linux_pauth_regset, "pauth registers", cb_data); } + + /* FIXME-Morello: We still need to provide a valid check for the presence of + capability registers. */ + if (tdep->has_capability ()) + { + cb (".reg-cap", AARCH64_LINUX_CREGS_SIZE, + AARCH64_LINUX_CREGS_SIZE, &aarch64_linux_cregset, + NULL, cb_data); + } } /* Implement the "core_read_description" gdbarch method. */ @@ -1815,6 +1845,13 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) if (tdep->has_capability ()) { + /* Initialize the register numbers for the core file register set. */ + /* FIXME-Morello: This needs to be updated. */ + aarch64_linux_cregmap[0].regno = tdep->cap_reg_base; + aarch64_linux_cregmap[1].regno = tdep->cap_reg_base + 32; + aarch64_linux_cregmap[2].regno = tdep->cap_reg_base + 31; + aarch64_linux_cregmap[3].regno = tdep->cap_reg_base + 33; + set_gdbarch_report_signal_info (gdbarch, aarch64_linux_report_signal_info); }