This adds an SB API into SBProcess:

  bool
  SBProcess::IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);

which simply tells whether a particular InstrumentationRuntime (read "ASan") 
plugin is present and active.

http://reviews.llvm.org/D5738

Files:
  include/lldb/API/SBProcess.h
  include/lldb/Target/Process.h
  scripts/Python/interface/SBProcess.i
  source/API/SBProcess.cpp
  source/Target/Process.cpp
Index: include/lldb/API/SBProcess.h
===================================================================
--- include/lldb/API/SBProcess.h
+++ include/lldb/API/SBProcess.h
@@ -319,6 +319,9 @@
     
     lldb::SBThreadCollection
     GetHistoryThreads (addr_t addr);
+    
+    bool
+    IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
 
 protected:
     friend class SBAddress;
Index: include/lldb/Target/Process.h
===================================================================
--- include/lldb/Target/Process.h
+++ include/lldb/Target/Process.h
@@ -2928,6 +2928,9 @@
     lldb::ThreadCollectionSP
     GetHistoryThreads(lldb::addr_t addr);
 
+    lldb::InstrumentationRuntimeSP
+    GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type);
+
 protected:
 
     //------------------------------------------------------------------
Index: scripts/Python/interface/SBProcess.i
===================================================================
--- scripts/Python/interface/SBProcess.i
+++ scripts/Python/interface/SBProcess.i
@@ -391,6 +391,9 @@
 
     lldb::SBThreadCollection
     GetHistoryThreads (addr_t addr);
+             
+    bool
+    IsInstrumentationRuntimePresent(lldb::InstrumentationRuntimeType type);
 
     %pythoncode %{
         def __get_is_alive__(self):
Index: source/API/SBProcess.cpp
===================================================================
--- source/API/SBProcess.cpp
+++ source/API/SBProcess.cpp
@@ -1394,3 +1394,18 @@
     }
     return threads;
 }
+
+bool
+SBProcess::IsInstrumentationRuntimePresent(InstrumentationRuntimeType type)
+{
+    ProcessSP process_sp(GetSP());
+    if (! process_sp)
+        return false;
+    
+    InstrumentationRuntimeSP runtime_sp = process_sp->GetInstrumentationRuntime(type);
+    
+    if (! runtime_sp.get())
+        return false;
+    
+    return runtime_sp->IsActive();
+}
Index: source/Target/Process.cpp
===================================================================
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -6071,3 +6071,16 @@
     
     return threads;
 }
+
+InstrumentationRuntimeSP
+Process::GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type)
+{
+    InstrumentationRuntimeCollection::iterator pos;
+    pos = m_instrumentation_runtimes.find (type);
+    if (pos == m_instrumentation_runtimes.end())
+    {
+        return InstrumentationRuntimeSP();
+    }
+    else
+        return (*pos).second;
+}
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to