================
@@ -1694,6 +1694,9 @@ 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 "\n",
----------------
DavidSpickett wrote:

Either you were mistaken about AppendMessageWithFormat adding a newline 
automatically, which it doesn't, unlike AppendMessage. For better or worse.

Or, I never showed enough of this feature for you to know whether it would be 
on a new line! I think that's probably it.

This is what I'm going for:
```
[0x0000000000000000-0x000aaaae3b140000) ---
[0x000aaaae3b140000-0x000aaaae3b150000) r-x 
/tmp/test_lldb/linux/aarch64/permission_overlay/2/TestAArch64LinuxPOE/a.out 
PT_LOAD[0]
protection key: 0
[0x000aaaae3b150000-0x000aaaae3b160000) rw- 
/tmp/test_lldb/linux/aarch64/permission_overlay/2/TestAArch64LinuxPOE/a.out
protection key: 0
```
(and I put that in the PR description now too)

Without the newline it's all jumbled:
```
[0x0000000000000000-0x000aaaaad99e0000) ---
[0x000aaaaad99e0000-0x000aaaaad99f0000) r-x 
/tmp/test_lldb/linux/aarch64/permission_overlay/2/TestAArch64LinuxPOE/a.out 
PT_LOAD[0]
protection key: 0[0x000aaaaad99f0000-0x000aaaaad9a00000) rw- 
/tmp/test_lldb/linux/aarch64/permission_overlay/2/TestAArch64LinuxPOE/a.out
protection key: 0[0x000aaaaad9a00000-0x000aaaaafa390000) ---
[0x000aaaaafa390000-0x000aaaaafa3c0000) rw- [heap]
```
The idea is to be like the `memory tagging: enabled` or `shadow stack: yes` 
lines like:
```
[addr-addr) ---
protection key: N
memory tagging: enabled
shadow stack: yes
```
So the address range is the "header" for the region.

https://github.com/llvm/llvm-project/pull/182246
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to