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/scripts | |
| 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/scripts')
| -rw-r--r-- | lldb/scripts/interface/SBProcess.i | 12 | ||||
| -rw-r--r-- | lldb/scripts/interface/SBProcessInfo.i | 66 | ||||
| -rw-r--r-- | lldb/scripts/lldb.swig | 2 |
3 files changed, 80 insertions, 0 deletions
diff --git a/lldb/scripts/interface/SBProcess.i b/lldb/scripts/interface/SBProcess.i index 527442e274e..55d39f826b7 100644 --- a/lldb/scripts/interface/SBProcess.i +++ b/lldb/scripts/interface/SBProcess.i @@ -417,6 +417,18 @@ public: lldb::SBMemoryRegionInfoList GetMemoryRegions(); + %feature("autodoc", " + Get information about the process. + Valid process info will only be returned when the process is alive, + use IsValid() to check if the info returned is valid. + + process_info = process.GetProcessInfo() + if process_info.IsValid(): + process_info.GetProcessID() + ") GetProcessInfo; + lldb::SBProcessInfo + GetProcessInfo(); + %pythoncode %{ def __get_is_alive__(self): '''Returns "True" if the process is currently alive, "False" otherwise''' diff --git a/lldb/scripts/interface/SBProcessInfo.i b/lldb/scripts/interface/SBProcessInfo.i new file mode 100644 index 00000000000..7332e67a966 --- /dev/null +++ b/lldb/scripts/interface/SBProcessInfo.i @@ -0,0 +1,66 @@ +//===-- SWIG Interface for SBProcessInfo-------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +namespace lldb { + +%feature("docstring", +"Describes an existing process and any discoverable information that pertains to +that process." +) SBProcessInfo; + +class SBProcessInfo +{ +public: + SBProcessInfo(); + + SBProcessInfo (const SBProcessInfo &rhs); + + ~SBProcessInfo (); + + bool + IsValid (); + + const char * + GetName (); + + SBFileSpec + GetExecutableFile (); + + lldb::pid_t + GetProcessID (); + + uint32_t + GetUserID (); + + uint32_t + GetGroupID (); + + bool + UserIDIsValid (); + + bool + GroupIDIsValid (); + + uint32_t + GetEffectiveUserID (); + + uint32_t + GetEffectiveGroupID (); + + bool + EffectiveUserIDIsValid (); + + bool + EffectiveGroupIDIsValid (); + + lldb::pid_t + GetParentProcessID (); +}; + +} // namespace lldb diff --git a/lldb/scripts/lldb.swig b/lldb/scripts/lldb.swig index 8345a4b9503..044cfc0b2cd 100644 --- a/lldb/scripts/lldb.swig +++ b/lldb/scripts/lldb.swig @@ -111,6 +111,7 @@ import six #include "lldb/API/SBModuleSpec.h" #include "lldb/API/SBPlatform.h" #include "lldb/API/SBProcess.h" +#include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBSection.h" @@ -196,6 +197,7 @@ import six %include "./interface/SBModuleSpec.i" %include "./interface/SBPlatform.i" %include "./interface/SBProcess.i" +%include "./interface/SBProcessInfo.i" %include "./interface/SBQueue.i" %include "./interface/SBQueueItem.i" %include "./interface/SBSection.i" |

