[Lldb-commits] [lldb] [lldb][debugserver] Get the size of the shared cache in mapped VM (PR #187419)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 19 07:09:20 PDT 2026
================
@@ -0,0 +1,52 @@
+"""
+Test that we can get the vm range of the shared cache.
+"""
+
+import lldb
+import re
+import json
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class SharedCacheVMRangeTestCase(TestBase):
+ NO_DEBUG_INFO_TESTCASE = True
+
+ @skipIfRemote
+ @skipUnlessDarwin
+ @skipIfOutOfTreeDebugserver # debugserver returns shared_cache_size
+ def test_shared_cache_vm_range(self):
+ """Test that the shared cache VM range contains a known libc function"""
+ self.build()
+ target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
+ self, "// break here", lldb.SBFileSpec("main.c")
+ )
+
+ res = lldb.SBCommandReturnObject()
+ ci = self.dbg.GetCommandInterpreter()
+ self.assertTrue(ci, VALID_COMMAND_INTERPRETER)
+
+ ci.HandleCommand("process plugin packet send jGetSharedCacheInfo:{}", res)
+
+ # 'packet: jGetSharedCacheInfo:{} response: {"shared_cache_base_address":6572900352,"shared_cache_uuid":"674DB25A-34B2-3C56-8BD4-7D78005B2F2E","no_shared_cache":false,"shared_cache_private_cache":false,"shared_cache_path":"/System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld/dyld_shared_cache_arm64e","shared_cache_size":5820792832}'
----------------
JDevlieghere wrote:
Maybe prettify this for readability:
```suggestion
# packet: jGetSharedCacheInfo:{}
# response:
# {
# "shared_cache_base_address": 6572900352,
# "shared_cache_uuid": "674DB25A-34B2-3C56-8BD4-7D78005B2F2E",
# "no_shared_cache": false,
# "shared_cache_private_cache": false,
# "shared_cache_path": "/System/Volumes/Preboot/Cryptexes/OS/System/Library/dyld/dyld_shared_cache_arm64e",
# "shared_cache_size": 5820792832
# }
```
https://github.com/llvm/llvm-project/pull/187419
More information about the lldb-commits
mailing list