2 from lldbsuite
.test
.lldbtest
import *
3 from lldbsuite
.test
.decorators
import *
4 from lldbsuite
.test
.gdbclientutils
import *
5 from lldbsuite
.test
.lldbgdbclient
import GDBRemoteTestBase
8 class TestStopPCs(GDBRemoteTestBase
):
9 @skipIfXmlSupportMissing
11 class MyResponder(MockGDBServerResponder
):
13 # lldb should treat the default halt reason, hwbreak and swbreak in the same way. Which is that it
14 # expects the stub to have corrected the PC already, so lldb should not modify it further.
15 return "T02thread:1ff0d;threads:1ff0d,2ff0d,3ff0d;thread-pcs:10001bc00,10002bc00,10003bc00;"
17 def threadStopInfo(self
, threadnum
):
18 if threadnum
== 0x1FF0D:
19 return "T02thread:1ff0d;threads:1ff0d,2ff0d,3ff0d;thread-pcs:10001bc00,10002bc00,10003bc00;"
20 if threadnum
== 0x2FF0D:
21 return "T00swbreak:;thread:2ff0d;threads:1ff0d,2ff0d,3ff0d;thread-pcs:10001bc00,10002bc00,10003bc00;"
22 if threadnum
== 0x3FF0D:
23 return "T00hwbreak:;thread:3ff0d;threads:1ff0d,2ff0d,3ff0d;thread-pcs:10001bc00,10002bc00,10003bc00;"
25 def qXferRead(self
, obj
, annex
, offset
, length
):
26 if annex
== "target.xml":
28 """<?xml version="1.0"?>
29 <target version="1.0">
30 <architecture>i386:x86-64</architecture>
31 <feature name="org.gnu.gdb.i386.core">
32 <reg name="rip" bitsize="64" regnum="0" type="code_ptr" group="general"/>
40 self
.server
.responder
= MyResponder()
41 target
= self
.dbg
.CreateTarget("")
43 self
.runCmd("log enable gdb-remote packets")
44 self
.addTearDownHook(lambda: self
.runCmd("log disable gdb-remote packets"))
45 process
= self
.connect(target
)
47 self
.assertEqual(process
.GetNumThreads(), 3)
48 th0
= process
.GetThreadAtIndex(0)
49 th1
= process
.GetThreadAtIndex(1)
50 th2
= process
.GetThreadAtIndex(2)
51 self
.assertEqual(th0
.GetThreadID(), 0x1FF0D)
52 self
.assertEqual(th1
.GetThreadID(), 0x2FF0D)
53 self
.assertEqual(th2
.GetThreadID(), 0x3FF0D)
54 self
.assertEqual(th0
.GetFrameAtIndex(0).GetPC(), 0x10001BC00)
55 self
.assertEqual(th1
.GetFrameAtIndex(0).GetPC(), 0x10002BC00)
56 self
.assertEqual(th2
.GetFrameAtIndex(0).GetPC(), 0x10003BC00)