]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[Morello] Teach gdb about additional CHERI auxv entries
authorLuis Machado <luis.machado@arm.com>
Fri, 11 Aug 2023 08:45:44 +0000 (09:45 +0100)
committerLuis Machado <luis.machado@arm.com>
Fri, 11 Aug 2023 10:32:02 +0000 (11:32 +0100)
CHERI/Morello defines some new auxv entries.  Make sure gdb understands
their type, even though gdb doesn't know how to display the capabilities
themselves.

gdb/auxv.c
include/elf/common.h

index 87fc01db25c535dd2fa522aff2189d16c41a0ced..ed290075151b1b917f7f5bd68a303a41e00dc90a 100644 (file)
@@ -540,6 +540,28 @@ default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
           AUXV_FORMAT_HEX);
       TAG (AT_SUN_CAP_HW2, _("Machine-dependent CPU capability hints 2"),
           AUXV_FORMAT_HEX);
+
+      /* CHERI-specific auxv entries.  */
+      TAG (AT_CHERI_EXEC_RW_CAP,
+          _("The executable's RW region capability, if it exists"),
+          AUXV_FORMAT_HEX);
+      TAG (AT_CHERI_EXEC_RX_CAP, _("The executable's RX capability"),
+          AUXV_FORMAT_HEX);
+      TAG (AT_CHERI_INTERP_RW_CAP,
+          _("The interpreter's RW region capability, if it exists"),
+          AUXV_FORMAT_HEX);
+      TAG (AT_CHERI_INTERP_RX_CAP, _("The interpreter's RX region capability"),
+          AUXV_FORMAT_HEX);
+      TAG (AT_CHERI_STACK_CAP, _("The stack capability"), AUXV_FORMAT_HEX);
+      TAG (AT_CHERI_SEAL_CAP, _("The root sealing capability"),
+          AUXV_FORMAT_HEX);
+      TAG (AT_CHERI_CID_CAP, _("The root CID capability"), AUXV_FORMAT_HEX);
+      TAG (AT_ARGC, _("The number of initial arguments"), AUXV_FORMAT_DEC);
+      TAG (AT_ARGV, _("Capability to the initial arguments"), AUXV_FORMAT_HEX);
+      TAG (AT_ENVC, _("The number of initial environment variable entries"),
+          AUXV_FORMAT_DEC);
+      TAG (AT_ENVP, _("Capability to the initial environment variables"),
+          AUXV_FORMAT_HEX);
     }
 
   fprint_auxv_entry (file, name, description, format, type, val);
index c6a31cc1f5e638ac962515a6fb51b228b0020179..edd864ea1405f92f2dee3c381bfcba5ca9446d76 100644 (file)
 #define        AT_SUN_BRAND_AUX3 2022
 #define        AT_SUN_CAP_HW2  2023    /* Extension of AT_SUN_CAP_HW1.  */
 
+/* CHERI auxv types.  */
+#define AT_CHERI_EXEC_RW_CAP   60
+#define AT_CHERI_EXEC_RX_CAP   61
+#define AT_CHERI_INTERP_RW_CAP 62
+#define AT_CHERI_INTERP_RX_CAP 63
+#define AT_CHERI_STACK_CAP     64
+#define AT_CHERI_SEAL_CAP      65
+#define AT_CHERI_CID_CAP       66
+#define AT_ARGC                        80
+#define AT_ARGV                        81
+#define AT_ENVC                        82
+#define AT_ENVP                        83
+
 #endif /* _ELF_COMMON_H */