diff options
author | Todd Fiala <todd.fiala@gmail.com> | 2016-08-19 03:03:58 +0000 |
---|---|---|
committer | Todd Fiala <todd.fiala@gmail.com> | 2016-08-19 03:03:58 +0000 |
commit | a07e4a8352562f0d63191ed76a152166e14bb268 (patch) | |
tree | 63b8691ddfcad1a9569002b503a830dd78a763e8 /lldb/source/API | |
parent | fdc4c6b426aa6492ce3ed175fc6180aec5964fce (diff) | |
download | bcm5719-llvm-a07e4a8352562f0d63191ed76a152166e14bb268.tar.gz bcm5719-llvm-a07e4a8352562f0d63191ed76a152166e14bb268.zip |
Revert "Add StructuredData plugin type; showcase with new DarwinLog feature"
This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8.
llvm-svn: 279200
Diffstat (limited to 'lldb/source/API')
-rw-r--r-- | lldb/source/API/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 2 | ||||
-rw-r--r-- | lldb/source/API/SBProcess.cpp | 31 | ||||
-rw-r--r-- | lldb/source/API/SBStructuredData.cpp | 165 | ||||
-rw-r--r-- | lldb/source/API/SystemInitializerFull.cpp | 8 |
5 files changed, 4 insertions, 203 deletions
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index 3dba1b08703..8e9e1fb2278 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -47,7 +47,6 @@ add_lldb_library(liblldb SHARED SBSourceManager.cpp SBStream.cpp SBStringList.cpp - SBStructuredData.cpp SBSymbol.cpp SBSymbolContext.cpp SBSymbolContextList.cpp diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index cc55230d8b3..3493ad507a7 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -491,7 +491,7 @@ SBDebugger::HandleProcessEvent (const SBProcess &process, const SBEvent &event, if (err != nullptr) ::fwrite (stdio_buffer, 1, len, err); } - + if (event_type & Process::eBroadcastBitStateChanged) { StateType event_state = SBProcess::GetStateFromEvent (event); diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index 9b8ac8461ac..50211bfde32 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -39,7 +39,6 @@ #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBMemoryRegionInfo.h" #include "lldb/API/SBMemoryRegionInfoList.h" -#include "lldb/API/SBStructuredData.h" #include "lldb/API/SBThread.h" #include "lldb/API/SBThreadCollection.h" #include "lldb/API/SBStream.h" @@ -1030,16 +1029,8 @@ SBProcess::GetRestartedReasonAtIndexFromEvent (const lldb::SBEvent &event, size_ SBProcess SBProcess::GetProcessFromEvent (const SBEvent &event) { - ProcessSP process_sp = - Process::ProcessEventData::GetProcessFromEvent (event.get()); - if (!process_sp) - { - // StructuredData events also know the process they come from. - // Try that. - process_sp = EventDataStructuredData::GetProcessFromEvent(event.get()); - } - - return SBProcess(process_sp); + SBProcess process(Process::ProcessEventData::GetProcessFromEvent (event.get())); + return process; } bool @@ -1048,26 +1039,10 @@ SBProcess::GetInterruptedFromEvent (const SBEvent &event) return Process::ProcessEventData::GetInterruptedFromEvent(event.get()); } -lldb::SBStructuredData -SBProcess::GetStructuredDataFromEvent (const lldb::SBEvent &event) -{ - return SBStructuredData(event.GetSP()); -} - bool SBProcess::EventIsProcessEvent (const SBEvent &event) { - return (event.GetBroadcasterClass() == SBProcess::GetBroadcasterClass()) && - !EventIsStructuredDataEvent (event); -} - -bool -SBProcess::EventIsStructuredDataEvent (const lldb::SBEvent &event) -{ - EventSP event_sp = event.GetSP(); - EventData *event_data = event_sp ? event_sp->GetData() : nullptr; - return event_data && - (event_data->GetFlavor() == EventDataStructuredData::GetFlavorString()); + return event.GetBroadcasterClass() == SBProcess::GetBroadcasterClass(); } SBBroadcaster diff --git a/lldb/source/API/SBStructuredData.cpp b/lldb/source/API/SBStructuredData.cpp deleted file mode 100644 index 5e4417484f0..00000000000 --- a/lldb/source/API/SBStructuredData.cpp +++ /dev/null @@ -1,165 +0,0 @@ -//===-- SBStructuredData.cpp ------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/API/SBStructuredData.h" - -#include "lldb/API/SBStream.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Event.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StructuredData.h" -#include "lldb/Target/StructuredDataPlugin.h" - -using namespace lldb; -using namespace lldb_private; - -#pragma mark -- -#pragma mark Impl - -class SBStructuredData::Impl -{ -public: - - Impl() : - m_plugin_wp(), - m_data_sp() - { - } - - Impl(const Impl &rhs) = default; - - Impl(const EventSP &event_sp) : - m_plugin_wp(EventDataStructuredData::GetPluginFromEvent(event_sp.get())), - m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) - { - } - - ~Impl() = default; - - Impl& - operator =(const Impl &rhs) = default; - - bool - IsValid() const - { - return m_data_sp.get() != nullptr; - } - - void - Clear() - { - m_plugin_wp.reset(); - m_data_sp.reset(); - } - - SBError - GetAsJSON(lldb::SBStream &stream) const - { - SBError sb_error; - - if (!m_data_sp) - { - sb_error.SetErrorString("No structured data."); - return sb_error; - } - - m_data_sp->Dump(stream.ref()); - return sb_error; - } - - lldb::SBError - GetDescription(lldb::SBStream &stream) const - { - SBError sb_error; - - if (!m_data_sp) - { - sb_error.SetErrorString("Cannot pretty print structured data: " - "no data to print."); - return sb_error; - } - - // Grab the plugin. - auto plugin_sp = StructuredDataPluginSP(m_plugin_wp); - if (!plugin_sp) - { - sb_error.SetErrorString("Cannot pretty print structured data: " - "plugin doesn't exist."); - return sb_error; - } - - // Get the data's description. - auto error = plugin_sp->GetDescription(m_data_sp, stream.ref()); - if (!error.Success()) - sb_error.SetError(error); - - return sb_error; - } - -private: - - StructuredDataPluginWP m_plugin_wp; - StructuredData::ObjectSP m_data_sp; - -}; - -#pragma mark -- -#pragma mark SBStructuredData - - -SBStructuredData::SBStructuredData() : - m_impl_up(new Impl()) -{ -} - -SBStructuredData::SBStructuredData(const lldb::SBStructuredData &rhs) : - m_impl_up(new Impl(*rhs.m_impl_up.get())) -{ -} - -SBStructuredData::SBStructuredData(const lldb::EventSP &event_sp) : - m_impl_up(new Impl(event_sp)) -{ -} - -SBStructuredData::~SBStructuredData() -{ -} - -SBStructuredData & -SBStructuredData::operator =(const lldb::SBStructuredData &rhs) -{ - *m_impl_up = *rhs.m_impl_up; - return *this; -} - -bool -SBStructuredData::IsValid() const -{ - return m_impl_up->IsValid(); -} - -void -SBStructuredData::Clear() -{ - m_impl_up->Clear(); -} - -SBError -SBStructuredData::GetAsJSON(lldb::SBStream &stream) const -{ - return m_impl_up->GetAsJSON(stream); -} - -lldb::SBError -SBStructuredData::GetDescription(lldb::SBStream &stream) const -{ - return m_impl_up->GetDescription(stream); -} - diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp index 00cbb5dee75..8644757229c 100644 --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -100,7 +100,6 @@ #include "Plugins/Process/mach-core/ProcessMachCore.h" #include "Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.h" #endif -#include "Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h" #if defined(__FreeBSD__) #include "Plugins/Process/FreeBSD/ProcessFreeBSD.h" @@ -382,11 +381,6 @@ SystemInitializerFull::Initialize() PlatformRemoteAppleWatch::Initialize(); DynamicLoaderDarwinKernel::Initialize(); #endif - - // This plugin is valid on any host that talks to a Darwin remote. - // It shouldn't be limited to __APPLE__. - StructuredDataDarwinLog::Initialize(); - //---------------------------------------------------------------------- // Platform agnostic plugins //---------------------------------------------------------------------- @@ -519,8 +513,6 @@ SystemInitializerFull::Terminate() platform_gdb_server::PlatformRemoteGDBServer::Terminate(); process_gdb_remote::ProcessGDBRemote::Terminate(); - StructuredDataDarwinLog::Terminate(); - DynamicLoaderMacOSXDYLD::Terminate(); DynamicLoaderMacOS::Terminate(); DynamicLoaderPOSIXDYLD::Terminate(); |