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
diff --git a/lldb/scripts/interface/SBProcess.i b/lldb/scripts/interface/SBProcess.i
index 527442e..55d39f8 100644
--- a/lldb/scripts/interface/SBProcess.i
+++ b/lldb/scripts/interface/SBProcess.i
@@ -417,6 +417,18 @@
     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 0000000..7332e67
--- /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