diff options
author | Vadim Macagon <vadim.macagon@gmail.com> | 2017-08-01 07:34:26 +0000 |
---|---|---|
committer | Vadim Macagon <vadim.macagon@gmail.com> | 2017-08-01 07:34:26 +0000 |
commit | 141a6263da497bb2d7b1d4595d0c0303c31dad4f (patch) | |
tree | 4e900ef519d0b31e032b79ffdfb85a0f10b139e4 /lldb/packages/Python/lldbsuite/test/python_api/default-constructor | |
parent | e4c220e8f21cc62c8179e2a9dff12436935e62f4 (diff) | |
download | bcm5719-llvm-141a6263da497bb2d7b1d4595d0c0303c31dad4f.tar.gz bcm5719-llvm-141a6263da497bb2d7b1d4595d0c0303c31dad4f.zip |
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
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/default-constructor')
2 files changed, 33 insertions, 0 deletions
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 @@ -255,6 +255,17 @@ class APIDefaultConstructorTestCase(TestBase): @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): obj = lldb.SBSection() if self.TraceOn(): 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() |