[Lldb-commits] [lldb] r219560 - Add a IsInstrumentationRuntimePresent SB API

Kuba Brecka kuba.brecka at gmail.com
Fri Oct 10 18:59:33 PDT 2014


Author: kuba.brecka
Date: Fri Oct 10 20:59:32 2014
New Revision: 219560

URL: http://llvm.org/viewvc/llvm-project?rev=219560&view=rev
Log:
Add a IsInstrumentationRuntimePresent SB API

Reviewed at http://reviews.llvm.org/D5738

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.



Modified:
    lldb/trunk/include/lldb/API/SBProcess.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/scripts/Python/interface/SBProcess.i
    lldb/trunk/source/API/SBProcess.cpp
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=219560&r1=219559&r2=219560&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Fri Oct 10 20:59:32 2014
@@ -319,6 +319,9 @@ public:
     
     lldb::SBThreadCollection
     GetHistoryThreads (addr_t addr);
+    
+    bool
+    IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
 
 protected:
     friend class SBAddress;

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=219560&r1=219559&r2=219560&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Fri Oct 10 20:59:32 2014
@@ -2928,6 +2928,9 @@ public:
     lldb::ThreadCollectionSP
     GetHistoryThreads(lldb::addr_t addr);
 
+    lldb::InstrumentationRuntimeSP
+    GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type);
+
 protected:
 
     //------------------------------------------------------------------

Modified: lldb/trunk/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBProcess.i?rev=219560&r1=219559&r2=219560&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBProcess.i (original)
+++ lldb/trunk/scripts/Python/interface/SBProcess.i Fri Oct 10 20:59:32 2014
@@ -391,6 +391,9 @@ public:
 
     lldb::SBThreadCollection
     GetHistoryThreads (addr_t addr);
+             
+    bool
+    IsInstrumentationRuntimePresent(lldb::InstrumentationRuntimeType type);
 
     %pythoncode %{
         def __get_is_alive__(self):

Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=219560&r1=219559&r2=219560&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Fri Oct 10 20:59:32 2014
@@ -1394,3 +1394,18 @@ SBProcess::GetHistoryThreads (addr_t add
     }
     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();
+}

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=219560&r1=219559&r2=219560&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri Oct 10 20:59:32 2014
@@ -6071,3 +6071,16 @@ Process::GetHistoryThreads(lldb::addr_t
     
     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;
+}





More information about the lldb-commits mailing list