aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/API/lua_api')
-rw-r--r--lldb/test/API/lua_api/TestThreadAPI.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/lldb/test/API/lua_api/TestThreadAPI.lua b/lldb/test/API/lua_api/TestThreadAPI.lua
new file mode 100644
index 0000000..5a38d0b
--- /dev/null
+++ b/lldb/test/API/lua_api/TestThreadAPI.lua
@@ -0,0 +1,25 @@
+_T = require('lua_lldb_test').create_test('TestThreadAPI')
+
+function _T:TestGetStopDescription()
+ local target = self:create_target()
+ local breakpoint = target:BreakpointCreateByName("main", "a.out")
+ assertTrue(breakpoint:IsValid() and breakpoint:GetNumLocations() == 1)
+
+ local process = target:LaunchSimple({ 'arg1', 'arg2' }, nil, nil)
+ local thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ assertNotNil(thread)
+ assertTrue(thread:IsValid())
+
+ assertEqual("breakpoint", thread:GetStopDescription(string.len("breakpoint") + 1))
+ assertEqual("break", thread:GetStopDescription(string.len("break") + 1))
+ assertEqual("b", thread:GetStopDescription(string.len("b") + 1))
+ assertEqual("breakpoint 1.1", thread:GetStopDescription(string.len("breakpoint 1.1") + 100))
+
+ -- Test stream variation
+ local stream = lldb.SBStream()
+ assertTrue(thread:GetStopDescription(stream))
+ assertNotNil(stream)
+ assertEqual("breakpoint 1.1", stream:GetData())
+end
+
+os.exit(_T:run())