From 4353c8e3fa6fb5bd28a43a949e32e27be3ecc575 Mon Sep 17 00:00:00 2001 From: Luis Machado Date: Wed, 10 Mar 2021 10:16:56 -0300 Subject: [PATCH] Fix extracting tags from PCC and CSP 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 * aarch64-tdep.c (aarch64_register_tag): Handle PCC/CSP tag extraction. --- gdb/aarch64-tdep.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 14531b27009..e4ac51a00ab 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -4189,6 +4189,16 @@ aarch64_register_tag (struct gdbarch *gdbarch, regnum > tdep->cap_reg_last - 2) return false; + /* The CSP/PCC tags are swapped in the tag_map because the ordering of CSP/PCC + in struct user_morello_state is different from GDB's register description. + + Make sure we account for that when extracting the tag from those + registers. */ + if (regnum == tdep->cap_reg_pcc) + regnum = tdep->cap_reg_csp; + else if (regnum == tdep->cap_reg_csp) + regnum = tdep->cap_reg_pcc; + /* Find the proper bit within the tag_map. */ int shift = regnum - tdep->cap_reg_base; ULONGEST tag_map = 0; -- 2.47.2