6 from lldbsuite
.test
.decorators
import *
7 from lldbsuite
.test
.lldbtest
import *
8 from lldbsuite
.test
import lldbutil
11 @skipIfFBSDVMCoreSupportMissing
12 class FreeBSDKernelVMCoreTestCase(TestBase
):
13 NO_DEBUG_INFO_TESTCASE
= True
16 def make_target(self
, src_filename
):
17 src
= self
.getSourcePath(src_filename
)
18 dest
= self
.getBuildArtifact("kernel")
19 self
.yaml2obj(src
, dest
, max_size
=30 * 1024 * 1024)
20 return self
.dbg
.CreateTarget(dest
)
22 def make_vmcore(self
, src_filename
):
23 src
= self
.getSourcePath(src_filename
)
24 dest
= self
.getBuildArtifact("vmcore")
25 with bz2
.open(src
, "rb") as inf
:
26 with
open(dest
, "wb") as outf
:
27 shutil
.copyfileobj(inf
, outf
)
30 def do_test(self
, kernel_yaml
, vmcore_bz2
, numthread
, threads
={}, hz
=100):
31 target
= self
.make_target(kernel_yaml
)
32 vmcore_file
= self
.make_vmcore(vmcore_bz2
)
33 process
= target
.LoadCore(vmcore_file
)
35 self
.assertTrue(process
, PROCESS_IS_VALID
)
36 self
.assertEqual(process
.GetNumThreads(), numthread
)
37 self
.assertEqual(process
.GetProcessID(), 0)
40 self
.expect("expr -- *(int *) &hz", substrs
=["(int) $0 = %d" % hz
])
42 main_mod
= target
.GetModuleAtIndex(0)
43 hz_addr
= main_mod
.FindSymbols("hz")[0].symbol
.addr
.GetLoadAddress(target
)
44 error
= lldb
.SBError()
45 self
.assertEqual(process
.ReadMemory(hz_addr
, 4, error
), struct
.pack("<I", hz
))
47 for thread_index
, thread_data
in threads
.items():
48 bt_expected
= thread_data
["bt"]
49 regs_expected
= thread_data
["regs"]
50 thread
= process
.GetThreadAtIndex(thread_index
)
51 self
.assertEqual(thread
.GetName(), thread_data
["name"])
55 [frame
.addr
.GetLoadAddress(target
) for frame
in thread
], bt_expected
59 regs
= thread
.GetFrameAtIndex(0).GetRegisters()
65 reg_values
[reg
.name
] = reg
.value
66 self
.assertEqual(reg_values
, regs_expected
)
68 self
.dbg
.DeleteTarget(target
)
70 def test_amd64_full_vmcore(self
):
73 "vmcore-amd64-full.bz2",
77 "name": "(pid 806) sysctl (crashed)",
92 "rbx": "0x0000000000000000",
93 "rbp": "0xfffffe0085cb2760",
94 "rsp": "0xfffffe0085cb2748",
95 "r12": "0xfffffe0045a6c300",
96 "r13": "0xfffff800033693a8",
97 "r14": "0x0000000000000000",
98 "r15": "0xfffff80003369380",
99 "rip": "0xffffffff80c09ade",
103 "name": "(pid 11) idle/idle: cpu0 (on CPU 0)",
120 "rbx": "0xffffffff81d43950",
121 "rbp": "0xffffffff81d43820",
122 "rsp": "0xffffffff81d43808",
123 "r12": "0xfffff80003374000",
124 "r13": "0x00000000027be000",
125 "r14": "0x0000000000000000",
126 "r15": "0xfffffe00009f7300",
127 "rip": "0xffffffff81057988",
131 "name": "(pid 11) idle/idle: cpu9",
139 "rbx": "0x000000007fff29f4",
140 "rbp": "0xfffffe00007a4ad0",
141 "rsp": "0xfffffe00007a4a08",
142 "r12": "0xfffffe00009fd300",
143 "r13": "0x0000000000000608",
144 "r14": "0xfffffe00009250c0",
145 "r15": "0xfffffe0045a6c300",
146 "rip": "0xffffffff80c3c8c8",
152 def test_amd64_minidump(self
):
155 "vmcore-amd64-minidump.bz2",
159 "name": "(pid 800) sysctl (crashed)",
174 "rbx": "0x0000000000000000",
175 "rbp": "0xfffffe00798c4760",
176 "rsp": "0xfffffe00798c4748",
177 "r12": "0xfffffe0045b11c00",
178 "r13": "0xfffff800033693a8",
179 "r14": "0x0000000000000000",
180 "r15": "0xfffff80003369380",
181 "rip": "0xffffffff80c09ade",
185 "name": "(pid 28) pagedaemon/dom0 (on CPU 4)",
200 "rbx": "0xfffffe00008e2f30",
201 "rbp": "0xfffffe00008e2e00",
202 "rsp": "0xfffffe00008e2de8",
203 "r12": "0xfffff80003845000",
204 "r13": "0x00000000027be000",
205 "r14": "0x0000000000000004",
206 "r15": "0xfffffe00458c2700",
207 "rip": "0xffffffff81057988",
211 "name": "(pid 28) pagedaemon/laundry: dom0",
220 "rbx": "0x000000007fff25f1",
221 "rbp": "0xfffffe00527dd890",
222 "rsp": "0xfffffe00527dd7c8",
223 "r12": "0xfffffe0045b13100",
224 "r13": "0x0000000000000104",
225 "r14": "0xfffffe00008d70c0",
226 "r15": "0xfffffe00009f5e00",
227 "rip": "0xffffffff80c3c8c8",
233 def test_arm64_minidump(self
):
236 "vmcore-arm64-minidump.bz2",
241 "name": "(pid 939) sysctl (crashed)",
242 # TODO: fix unwinding
247 "x0": "0x0000000000000000",
248 "x1": "0x0000000000000000",
249 "x2": "0x0000000000000000",
250 "x3": "0x0000000000000000",
251 "x4": "0x0000000000000000",
252 "x5": "0x0000000000000000",
253 "x6": "0x0000000000000000",
254 "x7": "0x0000000000000000",
255 "x8": "0xffffa00001548700",
256 "x9": "0x0000000000000000",
257 "x10": "0xffffa00000e04580",
258 "x11": "0x0000000000000000",
259 "x12": "0x000000000008950a",
260 "x13": "0x0000000000089500",
261 "x14": "0x0000000000000039",
262 "x15": "0x0000000000000000",
263 "x16": "0x00000000ffffffd8",
264 "x17": "0x0000000000000000",
265 "x18": "0xffff000000e6d380",
266 "x19": "0xffff000000af9000",
267 "x20": "0xffff000000b82000",
268 "x21": "0xffffa00000319da8",
269 "x22": "0xffff000000b84000",
270 "x23": "0xffff000000b84000",
271 "x24": "0xffff000000b55000",
272 "x25": "0x0000000000000000",
273 "x26": "0x0000000000040800",
274 "x27": "0x0000000000000000",
275 "x28": "0x00000000002019ca",
276 "fp": "0xffff0000d58f23b0",
277 "sp": "0xffff0000d58f23b0",
278 "pc": "0xffff0000004b6e78",
282 "name": "(pid 21) syncer (on CPU 6)",
283 # TODO: fix unwinding
288 "x0": "0x0000000000000000",
289 "x1": "0x0000000000000000",
290 "x2": "0x0000000000000000",
291 "x3": "0x0000000000000000",
292 "x4": "0x0000000000000000",
293 "x5": "0x0000000000000000",
294 "x6": "0x0000000000000000",
295 "x7": "0x0000000000000000",
296 "x8": "0x0000000000000006",
297 "x9": "0x0000000000000560",
298 "x10": "0xffff000000e8f640",
299 "x11": "0x0000000000000001",
300 "x12": "0x0000000056000000",
301 "x13": "0x0000000000002af8",
302 "x14": "0x0000000000002710",
303 "x15": "0x0000000000000002",
304 "x16": "0x00000000ffffffff",
305 "x17": "0x0000000000000002",
306 "x18": "0xffff000000e6db80",
307 "x19": "0x0000000000000006",
308 "x20": "0xffff0000853a3670",
309 "x21": "0xffff0000009279c1",
310 "x22": "0x0000000000000804",
311 "x23": "0x0000000000000004",
312 "x24": "0xffff000082a93000",
313 "x25": "0xffffa0000053f080",
314 "x26": "0xffff000000e6391c",
315 "x27": "0xffff000000e63000",
316 "x28": "0x0000000000000004",
317 "fp": "0xffff0000853a35c0",
318 "sp": "0xffff0000853a35c0",
319 "pc": "0xffff000000811370",
323 "name": "(pid 11) idle/idle: cpu2",
324 # TODO: fix unwinding
329 "x0": "0x0000000000000000",
330 "x1": "0x0000000000000000",
331 "x2": "0x0000000000000000",
332 "x3": "0x0000000000000000",
333 "x4": "0x0000000000000000",
334 "x5": "0x0000000000000000",
335 "x6": "0x0000000000000000",
336 "x7": "0x0000000000000000",
337 "x8": "0x00000000ffffffff",
338 "x9": "0x0000000000000001",
339 "x10": "0x0000000000002710",
340 "x11": "0x000000007ff7e333",
341 "x12": "0x000000007ff7ba9c",
342 "x13": "0x0000000000002af8",
343 "x14": "0x0000000000002897",
344 "x15": "0x0000000000002af8",
345 "x16": "0x00000000000028e1",
346 "x17": "0x00000000ffffffff",
347 "x18": "0xffff000000e6d380",
348 "x19": "0xffffa0000032e580",
349 "x20": "0xffff000000b82000",
350 "x21": "0xffff000040517100",
351 "x22": "0xffffa00000e04580",
352 "x23": "0xffff000000b84000",
353 "x24": "0x0000000000000001",
354 "x25": "0xffff000000dd1000",
355 "x26": "0xffff000082783898",
356 "x27": "0xffff000000e26000",
357 "x28": "0xffff000000b82000",
358 "fp": "0xffff0000827835f0",
359 "sp": "0xffff000082783570",
360 "pc": "0xffff0000004ee99c",
366 def test_i386_minidump(self
):
369 "vmcore-i386-minidump.bz2",
373 "name": "(pid 806) sysctl (crashed)",
396 "name": "(pid 11) idle/idle: cpu0 (on CPU 0)",
413 "name": "(pid 11) idle/idle: cpu11",