Files
TheRock/compiler/amd-llvm/lldb/test/API/macosx/shared-cache-vm-range/TestSharedCacheVMRange.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

62 lines
2.2 KiB
Python

"""
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
# }
self.assertTrue("response: " in res.GetOutput())
response = re.search("response: (.+)", res.GetOutput()).group(1)
json_response = json.loads(response)
self.assertTrue("shared_cache_base_address" in json_response)
self.assertTrue("shared_cache_size" in json_response)
start = json_response["shared_cache_base_address"]
end = start + json_response["shared_cache_size"]
symctx_list = target.FindSymbols("printf", lldb.eSymbolTypeCode)
self.assertGreater(symctx_list.GetSize(), 0)
symctx = symctx_list.GetContextAtIndex(0)
sym = symctx.GetSymbol()
self.assertTrue(sym.IsValid())
addr = sym.GetStartAddress()
printf_load_addr = addr.GetLoadAddress(target)
self.assertGreater(printf_load_addr, start)
self.assertLess(printf_load_addr, end)