blob: 4190ea3ac33184a0121ca7489eef201faa38a80a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
"""Test that Mach-O armv7/arm64 corefile register contexts are read by lldb."""
import os
import re
import subprocess
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestArmMachoCorefileRegctx(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
def setUp(self):
TestBase.setUp(self)
self.build()
self.create_corefile = self.getBuildArtifact("a.out")
self.corefile = self.getBuildArtifact("core")
def test_armv7_corefile(self):
### Create corefile
retcode = call(self.create_corefile + " armv7 " + self.corefile, shell=True)
target = self.dbg.CreateTarget("")
err = lldb.SBError()
process = target.LoadCore(self.corefile)
self.assertTrue(process.IsValid())
thread = process.GetSelectedThread()
frame = thread.GetSelectedFrame()
lr = frame.FindRegister("lr")
self.assertTrue(lr.IsValid())
self.assertEqual(lr.GetValueAsUnsigned(), 0x000F0000)
pc = frame.FindRegister("pc")
self.assertTrue(pc.IsValid())
self.assertEqual(pc.GetValueAsUnsigned(), 0x00100000)
exception = frame.FindRegister("exception")
self.assertTrue(exception.IsValid())
self.assertEqual(exception.GetValueAsUnsigned(), 0x00003F5C)
def test_arm64_corefile(self):
### Create corefile
retcode = call(self.create_corefile + " arm64 " + self.corefile, shell=True)
target = self.dbg.CreateTarget("")
err = lldb.SBError()
process = target.LoadCore(self.corefile)
self.assertTrue(process.IsValid())
thread = process.GetSelectedThread()
frame = thread.GetSelectedFrame()
lr = frame.FindRegister("lr")
self.assertTrue(lr.IsValid())
self.assertEqual(lr.GetValueAsUnsigned(), 0x000000018CD97F28)
pc = frame.FindRegister("pc")
self.assertTrue(pc.IsValid())
self.assertEqual(pc.GetValueAsUnsigned(), 0x0000000100003F5C)
exception = frame.FindRegister("far")
self.assertTrue(exception.IsValid())
self.assertEqual(exception.GetValueAsUnsigned(), 0x0000000100003F5C)
|