6 from lldbsuite
.test
.decorators
import *
7 from lldbsuite
.test
.lldbtest
import *
8 from lldbsuite
.test
import lldbutil
11 class FreeBSDKernelVMCoreTestCase(TestBase
):
12 NO_DEBUG_INFO_TESTCASE
= True
15 kernel_exec
= "/boot/kernel/kernel"
16 mem_device
= "/dev/mem"
18 if not os
.access(kernel_exec
, os
.R_OK
):
19 self
.skipTest("Kernel @ %s is not readable" % (kernel_exec
,))
20 if not os
.access(mem_device
, os
.R_OK
):
21 self
.skipTest("Memory @ %s is not readable" % (mem_device
,))
23 target
= self
.dbg
.CreateTarget(kernel_exec
)
24 process
= target
.LoadCore(mem_device
)
25 hz_value
= int(subprocess
.check_output(["sysctl", "-n", "kern.hz"]))
27 self
.assertTrue(process
, PROCESS_IS_VALID
)
28 self
.assertEqual(process
.GetNumThreads(), 1)
29 self
.assertEqual(process
.GetProcessID(), 0)
32 self
.expect("expr -- *(int *) &hz", substrs
=["(int) $0 = %d" % hz_value
])
34 main_mod
= target
.GetModuleAtIndex(0)
35 hz_addr
= main_mod
.FindSymbols("hz")[0].symbol
.addr
.GetLoadAddress(target
)
36 error
= lldb
.SBError()
38 process
.ReadMemory(hz_addr
, 4, error
), struct
.pack("<I", hz_value
)
41 self
.dbg
.DeleteTarget(target
)