[Lldb-commits] [lldb] [lldb][Linux] Add overlay and effective permissions to "memory region" (PR #184115)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 2 05:22:10 PST 2026


================
@@ -1694,6 +1694,29 @@ class CommandObjectMemoryRegion : public CommandObjectParsed {
     MemoryRegionInfo::OptionalBool is_shadow_stack = range_info.IsShadowStack();
     if (is_shadow_stack == MemoryRegionInfo::OptionalBool::eYes)
       result.AppendMessage("shadow stack: yes");
+    if (std::optional<unsigned> protection_key =
+            range_info.GetProtectionKey()) {
+      result.AppendMessageWithFormat("protection key: %" PRIu32,
+                                     *protection_key);
+
+      if (const lldb::ABISP &abi = target.GetProcessSP()->GetABI()) {
+        uint32_t base_permissions = range_info.GetLLDBPermissions();
+        if (auto permissions =
+                abi->GetMemoryPermissions(*m_exe_ctx.GetRegisterContext(),
+                                          *protection_key, base_permissions)) {
+          result.AppendMessageWithFormatv(
----------------
DavidSpickett wrote:

Confusingly, WithFormatV *does* add a newline for you but WithFormat does not. Here were are happy to have the newline so FormatV is fine.

I'm going to look at migrating a lot of the WithFormat calls because a lot of them include a newline anyway.

https://github.com/llvm/llvm-project/pull/184115


More information about the lldb-commits mailing list