diff options
author | Kuba Brecka <kuba.brecka@gmail.com> | 2014-10-11 01:59:32 +0000 |
---|---|---|
committer | Kuba Brecka <kuba.brecka@gmail.com> | 2014-10-11 01:59:32 +0000 |
commit | 6392754839ebf14b8e2044da19d23a158db77207 (patch) | |
tree | d789774e9d55202114fb265ae60029c9b0c05e51 | |
parent | 19c2e631bd0264cdb48dcdefa0186913e55b72fb (diff) | |
download | bcm5719-llvm-6392754839ebf14b8e2044da19d23a158db77207.tar.gz bcm5719-llvm-6392754839ebf14b8e2044da19d23a158db77207.zip |
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.
llvm-svn: 219560
-rw-r--r-- | lldb/include/lldb/API/SBProcess.h | 3 | ||||
-rw-r--r-- | lldb/include/lldb/Target/Process.h | 3 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBProcess.i | 3 | ||||
-rw-r--r-- | lldb/source/API/SBProcess.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 13 |
5 files changed, 37 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 4324a554cf1..3d6e49c4821 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -319,6 +319,9 @@ public: lldb::SBThreadCollection GetHistoryThreads (addr_t addr); + + bool + IsInstrumentationRuntimePresent(InstrumentationRuntimeType type); protected: friend class SBAddress; diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index ee71f875036..c7b74491f7d 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -2928,6 +2928,9 @@ public: lldb::ThreadCollectionSP GetHistoryThreads(lldb::addr_t addr); + lldb::InstrumentationRuntimeSP + GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type); + protected: //------------------------------------------------------------------ diff --git a/lldb/scripts/Python/interface/SBProcess.i b/lldb/scripts/Python/interface/SBProcess.i index dce930c350b..e6f5464d0e6 100644 --- a/lldb/scripts/Python/interface/SBProcess.i +++ b/lldb/scripts/Python/interface/SBProcess.i @@ -391,6 +391,9 @@ public: lldb::SBThreadCollection GetHistoryThreads (addr_t addr); + + bool + IsInstrumentationRuntimePresent(lldb::InstrumentationRuntimeType type); %pythoncode %{ def __get_is_alive__(self): diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 7b519b16bd1..5231b4bc1ad 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -1394,3 +1394,18 @@ SBProcess::GetHistoryThreads (addr_t addr) } 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(); +} diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index d337d8110c8..9cb021c9283 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -6071,3 +6071,16 @@ Process::GetHistoryThreads(lldb::addr_t addr) 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; +} |