aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
authorEbuka Ezike <yerimyah1@gmail.com>2025-10-30 21:43:53 +0000
committerGitHub <noreply@github.com>2025-10-30 21:43:53 +0000
commitc46bfed1a484d30cd251a9a225649d74e3bf0af5 (patch)
tree6b1beefe494e0e518a2eaee28e9f87526c565b19 /lldb/test/API/python_api
parent6c1678abce2c31b0db22634aa19368095a75ca77 (diff)
downloadllvm-c46bfed1a484d30cd251a9a225649d74e3bf0af5.zip
llvm-c46bfed1a484d30cd251a9a225649d74e3bf0af5.tar.gz
llvm-c46bfed1a484d30cd251a9a225649d74e3bf0af5.tar.bz2
[lldb] Add alternative SBThread::GetStopDescription (#165379)
the function signature for `GetStopDescription` is `lldb::SBThread::GetStopDescription(char *dst_or_null, size_t len)`. To get a description you need to call the function first time to get the buffer size. a second time to get the description. This is little worse from the python size as the signature is `lldb.SBThread.GetStopDescription(int: len) -> list[str]` the user has to pass the max size as possible with no way of checking if it is enough. This patch adds a new api `lldb.SBThread.GetStopDescription(desc: lldb.SBStream()) -> bool` `bool lldb::SBThread::GetStopDescription(lldb::SBStream &description)` which handles this case. Adds new Test case for lua.
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/default-constructor/sb_thread.py1
-rw-r--r--lldb/test/API/python_api/thread/TestThreadAPI.py5
2 files changed, 6 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/default-constructor/sb_thread.py b/lldb/test/API/python_api/default-constructor/sb_thread.py
index 34eb3db..4252fa0 100644
--- a/lldb/test/API/python_api/default-constructor/sb_thread.py
+++ b/lldb/test/API/python_api/default-constructor/sb_thread.py
@@ -10,6 +10,7 @@ def fuzz_obj(obj):
obj.GetStopReasonDataCount()
obj.GetStopReasonDataAtIndex(100)
obj.GetStopDescription(256)
+ obj.GetStopDescription(lldb.SBStream())
obj.GetThreadID()
obj.GetIndexID()
obj.GetName()
diff --git a/lldb/test/API/python_api/thread/TestThreadAPI.py b/lldb/test/API/python_api/thread/TestThreadAPI.py
index 5583434a..acad758 100644
--- a/lldb/test/API/python_api/thread/TestThreadAPI.py
+++ b/lldb/test/API/python_api/thread/TestThreadAPI.py
@@ -138,6 +138,11 @@ class ThreadAPITestCase(TestBase):
"breakpoint 1.1", thread.GetStopDescription(len("breakpoint 1.1") + 100)
)
+ # Test the stream variation
+ stream = lldb.SBStream()
+ self.assertTrue(thread.GetStopDescription(stream))
+ self.assertEqual("breakpoint 1.1", stream.GetData())
+
def step_out_of_malloc_into_function_b(self, exe_name):
"""Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b()."""
exe = self.getBuildArtifact(exe_name)