From 141a6263da497bb2d7b1d4595d0c0303c31dad4f Mon Sep 17 00:00:00 2001 From: Vadim Macagon Date: Tue, 1 Aug 2017 07:34:26 +0000 Subject: Expose process instance info via SB API Summary: Implement SBProcessInfo to wrap lldb_private::ProcessInstanceInfo, and add SBProcess::GetProcessInfo() to retrieve info like parent ID, group ID, user ID etc. from a live process. Differential Revision: https://reviews.llvm.org/D35881 llvm-svn: 309664 --- .../TestDefaultConstructorForAPIObjects.py | 11 +++++++++++ .../default-constructor/sb_process_info.py | 22 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py (limited to 'lldb/packages/Python/lldbsuite/test/python_api/default-constructor') diff --git a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index 4739df00085..bea9f5962d6 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -253,6 +253,17 @@ class APIDefaultConstructorTestCase(TestBase): import sb_process sb_process.fuzz_obj(obj) + @add_test_categories(['pyapi']) + @no_debug_info_test + def test_SBProcessInfo(self): + obj = lldb.SBProcessInfo() + if self.TraceOn(): + print(obj) + self.assertFalse(obj) + # Do fuzz testing on the invalid obj, it should not crash lldb. + import sb_process_info + sb_process_info.fuzz_obj(obj) + @add_test_categories(['pyapi']) @no_debug_info_test def test_SBSection(self): diff --git a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py new file mode 100644 index 00000000000..020ad4e1066 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py @@ -0,0 +1,22 @@ +""" +Fuzz tests an object after the default construction to make sure it does not crash lldb. +""" + +import sys +import lldb + + +def fuzz_obj(obj): + obj.IsValid() + obj.GetName() + obj.GetExecutableFile() + obj.GetProcessID() + obj.GetUserID() + obj.GetGroupID() + obj.UserIDIsValid() + obj.GroupIDIsValid() + obj.GetEffectiveUserID() + obj.GetEffectiveGroupID() + obj.EffectiveUserIDIsValid() + obj.EffectiveGroupIDIsValid() + obj.GetParentProcessID() -- cgit v1.2.3