From 32abc6edac8fb7d4cb9472bf00246dba19d1d47b Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Tue, 3 Mar 2015 19:23:09 +0000 Subject: [PATCH] Reduce header footprint of Target.h This continues the effort to reduce header footprint and improve build speed by removing clang and other unnecessary headers from Target.h. In one case, some headers were included solely for the purpose of declaring a nested class in Target, which was not needed by anybody outside the class. In this case the definition and implementation of the nested class were isolated in the .cpp file so the header could be removed. llvm-svn: 231107 --- lldb/include/lldb/Breakpoint/Watchpoint.h | 5 +- lldb/include/lldb/Expression/ClangASTSource.h | 1 + lldb/include/lldb/Target/Target.h | 76 ++------- lldb/include/lldb/lldb-forward.h | 8 + lldb/source/API/SBAddress.cpp | 2 + lldb/source/API/SBTarget.cpp | 2 +- lldb/source/Commands/CommandObjectArgs.cpp | 1 + .../Commands/CommandObjectBreakpoint.cpp | 1 + .../source/Commands/CommandObjectRegister.cpp | 1 + lldb/source/Commands/CommandObjectTarget.cpp | 1 + lldb/source/Expression/ClangASTSource.cpp | 1 + .../Expression/ClangExpressionDeclMap.cpp | 1 + .../Hexagon-DYLD/HexagonDYLDRendezvous.cpp | 1 + .../MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp | 1 + .../POSIX-DYLD/DYLDRendezvous.cpp | 1 + .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 1 + .../Plugins/JITLoader/GDB/JITLoaderGDB.cpp | 3 +- .../AppleObjCTrampolineHandler.cpp | 1 + .../Plugins/Process/Utility/UnwindLLDB.cpp | 1 + .../UnwindAssembly/x86/UnwindAssembly-x86.cpp | 1 + lldb/source/Target/ObjCLanguageRuntime.cpp | 1 + lldb/source/Target/Target.cpp | 147 ++++++++++-------- lldb/source/Target/Thread.cpp | 1 + lldb/source/Target/ThreadPlanCallFunction.cpp | 1 + lldb/source/Target/ThreadPlanStepOut.cpp | 1 + lldb/source/Target/ThreadPlanTracer.cpp | 1 + 26 files changed, 130 insertions(+), 132 deletions(-) diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h b/lldb/include/lldb/Breakpoint/Watchpoint.h index 9bb03b9a91e2..926e0b506f31 100644 --- a/lldb/include/lldb/Breakpoint/Watchpoint.h +++ b/lldb/include/lldb/Breakpoint/Watchpoint.h @@ -20,10 +20,11 @@ // Project includes #include "lldb/lldb-private.h" -#include "lldb/Target/Target.h" -#include "lldb/Core/UserID.h" #include "lldb/Breakpoint/WatchpointOptions.h" #include "lldb/Breakpoint/StoppointLocation.h" +#include "lldb/Core/UserID.h" +#include "lldb/Symbol/ClangASTType.h" +#include "lldb/Target/Target.h" namespace lldb_private { diff --git a/lldb/include/lldb/Expression/ClangASTSource.h b/lldb/include/lldb/Expression/ClangASTSource.h index 23977fc82313..028bfb3666f6 100644 --- a/lldb/include/lldb/Expression/ClangASTSource.h +++ b/lldb/include/lldb/Expression/ClangASTSource.h @@ -15,6 +15,7 @@ #include "clang/Basic/IdentifierTable.h" #include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Symbol/ClangASTImporter.h" +#include "lldb/Symbol/ClangASTType.h" #include "lldb/Target/Target.h" #include "llvm/ADT/SmallSet.h" diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 971269804a88..78b74d5e424a 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -18,22 +18,12 @@ // Project includes #include "lldb/lldb-public.h" #include "lldb/Breakpoint/BreakpointList.h" -#include "lldb/Breakpoint/BreakpointLocationCollection.h" #include "lldb/Breakpoint/WatchpointList.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Disassembler.h" -#include "lldb/Core/Event.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/UserSettingsController.h" -#include "lldb/Expression/ClangModulesDeclVendor.h" -#include "lldb/Expression/ClangPersistentVariables.h" -#include "lldb/Interpreter/Args.h" -#include "lldb/Interpreter/OptionValueBoolean.h" -#include "lldb/Interpreter/OptionValueEnumeration.h" -#include "lldb/Interpreter/OptionValueFileSpec.h" -#include "lldb/Symbol/SymbolContext.h" -#include "lldb/Target/ABI.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Target/ProcessLaunchInfo.h" @@ -228,8 +218,6 @@ private: ProcessLaunchInfo m_launch_info; }; -typedef std::shared_ptr TargetPropertiesSP; - class EvaluateExpressionOptions { public: @@ -506,43 +494,6 @@ public: { return GetStaticBroadcasterClass(); } - - // This event data class is for use by the TargetList to broadcast new target notifications. - class TargetEventData : public EventData - { - public: - - static const ConstString & - GetFlavorString (); - - virtual const ConstString & - GetFlavor () const; - - TargetEventData (const lldb::TargetSP &new_target_sp); - - lldb::TargetSP & - GetTarget() - { - return m_target_sp; - } - - virtual - ~TargetEventData(); - - virtual void - Dump (Stream *s) const; - - static const lldb::TargetSP - GetTargetFromEvent (const lldb::EventSP &event_sp); - - static const TargetEventData * - GetEventDataFromEvent (const Event *event_sp); - - private: - lldb::TargetSP m_target_sp; - - DISALLOW_COPY_AND_ASSIGN (TargetEventData); - }; static void SettingsInitialize (); @@ -550,9 +501,6 @@ public: static void SettingsTerminate (); -// static lldb::UserSettingsControllerSP & -// GetSettingsController (); - static FileSpecList GetDefaultExecutableSearchPaths (); @@ -576,7 +524,7 @@ public: // Settings accessors //---------------------------------------------------------------------- - static const TargetPropertiesSP & + static const lldb::TargetPropertiesSP & GetGlobalProperties(); @@ -1226,10 +1174,7 @@ public: const EvaluateExpressionOptions& options = EvaluateExpressionOptions()); ClangPersistentVariables & - GetPersistentVariables() - { - return m_persistent_variables; - } + GetPersistentVariables(); //------------------------------------------------------------------ // Target Stop Hooks @@ -1267,10 +1212,7 @@ public: // Set the specifier. The stop hook will own the specifier, and is responsible for deleting it when we're done. void - SetSpecifier (SymbolContextSpecifier *specifier) - { - m_specifier_sp.reset (specifier); - } + SetSpecifier (SymbolContextSpecifier *specifier); SymbolContextSpecifier * GetSpecifier () @@ -1431,13 +1373,13 @@ protected: lldb::ProcessSP m_process_sp; lldb::SearchFilterSP m_search_filter_sp; PathMappingList m_image_search_paths; - std::unique_ptr m_scratch_ast_context_ap; - std::unique_ptr m_scratch_ast_source_ap; - std::unique_ptr m_ast_importer_ap; - std::unique_ptr m_clang_modules_decl_vendor_ap; - ClangPersistentVariables m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser. + lldb::ClangASTContextUP m_scratch_ast_context_ap; + lldb::ClangASTSourceUP m_scratch_ast_source_ap; + lldb::ClangASTImporterUP m_ast_importer_ap; + lldb::ClangModulesDeclVendorUP m_clang_modules_decl_vendor_ap; + lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser. - std::unique_ptr m_source_manager_ap; + lldb::SourceManagerUP m_source_manager_ap; typedef std::map StopHookCollection; StopHookCollection m_stop_hooks; diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index 7cf80e3298e6..b478fdef551e 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -58,6 +58,7 @@ class ClangExpressionVariableList; class ClangExpressionVariableList; class ClangExpressionVariables; class ClangFunction; +class ClangModulesDeclVendor; class ClangPersistentVariables; class ClangUserExpression; class ClangUtilityFunction; @@ -232,6 +233,7 @@ class QueueItem; class QueueImpl; class Target; class TargetList; +class TargetProperties; class Thread; class ThreadCollection; class ThreadList; @@ -302,7 +304,11 @@ namespace lldb { typedef std::shared_ptr BreakpointResolverSP; typedef std::shared_ptr BroadcasterSP; typedef std::unique_ptr ClangASTContextUP; + typedef std::unique_ptr ClangASTImporterUP; + typedef std::unique_ptr ClangASTSourceUP; typedef std::shared_ptr ClangExpressionVariableSP; + typedef std::unique_ptr ClangModulesDeclVendorUP; + typedef std::unique_ptr ClangPersistentVariablesUP; typedef std::shared_ptr CommandObjectSP; typedef std::shared_ptr CommunicationSP; typedef std::shared_ptr ConnectionSP; @@ -375,6 +381,7 @@ namespace lldb { typedef std::shared_ptr SectionLoadListSP; typedef std::shared_ptr SearchFilterSP; typedef std::shared_ptr SettingsSP; + typedef std::unique_ptr SourceManagerUP; typedef std::shared_ptr StackFrameSP; typedef std::unique_ptr StackFrameUP; typedef std::weak_ptr StackFrameWP; @@ -394,6 +401,7 @@ namespace lldb { typedef std::shared_ptr SyntheticChildrenFrontEndSP; typedef std::shared_ptr TargetSP; typedef std::weak_ptr TargetWP; + typedef std::shared_ptr TargetPropertiesSP; typedef std::shared_ptr ThreadSP; typedef std::weak_ptr ThreadWP; typedef std::shared_ptr ThreadCollectionSP; diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp index d6e32b60059b..f95fcb8b3985 100644 --- a/lldb/source/API/SBAddress.cpp +++ b/lldb/source/API/SBAddress.cpp @@ -14,7 +14,9 @@ #include "lldb/Core/Address.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" +#include "lldb/Core/StreamString.h" #include "lldb/Host/Mutex.h" +#include "lldb/Symbol/LineEntry.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index 94f76b39d2ac..b67d12ebe5a6 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -50,9 +50,9 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/VariableList.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Process.h" - #include "lldb/Target/Target.h" #include "lldb/Target/TargetList.h" diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp index b0fe42bc2446..58d8fcab760a 100644 --- a/lldb/source/Commands/CommandObjectArgs.cpp +++ b/lldb/source/Commands/CommandObjectArgs.cpp @@ -27,6 +27,7 @@ #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Variable.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index e36809f485fe..cb4715a8180c 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -21,6 +21,7 @@ #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Interpreter/OptionValueBoolean.h" #include "lldb/Interpreter/OptionValueString.h" #include "lldb/Interpreter/OptionValueUInt64.h" #include "lldb/Core/RegularExpression.h" diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index 81b79b8cd8b2..6d3f5e7b34c2 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -25,6 +25,7 @@ #include "lldb/Interpreter/Options.h" #include "lldb/Interpreter/OptionGroupFormat.h" #include "lldb/Interpreter/OptionValueArray.h" +#include "lldb/Interpreter/OptionValueBoolean.h" #include "lldb/Interpreter/OptionValueUInt64.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index b9e4942caefb..febcc55d0ddf 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -50,6 +50,7 @@ #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Symbol/VariableList.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/Process.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/StackFrame.h" diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index 015603ddf58c..30932920cb36 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -16,6 +16,7 @@ #include "lldb/Expression/ASTDumper.h" #include "lldb/Expression/ClangASTSource.h" #include "lldb/Expression/ClangExpression.h" +#include "lldb/Expression/ClangModulesDeclVendor.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/ClangNamespaceDecl.h" #include "lldb/Symbol/Function.h" diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index e3027378422f..5dc5ca53839d 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -22,6 +22,7 @@ #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Expression/ASTDumper.h" #include "lldb/Expression/ClangASTSource.h" +#include "lldb/Expression/ClangModulesDeclVendor.h" #include "lldb/Expression/ClangPersistentVariables.h" #include "lldb/Expression/Materializer.h" #include "lldb/Host/Endian.h" diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp index 5035e9d8bb17..61f9b3d441ce 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp @@ -15,6 +15,7 @@ #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/Symbol.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 434c8453fbb9..679c199a6ed9 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -21,6 +21,7 @@ #include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ObjCLanguageRuntime.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp index a504e801daac..d341d67d4483 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -16,6 +16,7 @@ #include "lldb/Core/Module.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/Symbol.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index fdef1026f3c6..1cebdca8cc36 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleSpec.h" +#include "lldb/Target/Platform.h" #include "lldb/Core/Section.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Process.h" diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp index cd303cb0768f..b9c71ad1ba4b 100644 --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -16,10 +16,11 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/Section.h" #include "lldb/Core/StreamString.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/SymbolVendor.h" #include "lldb/Target/Process.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" -#include "lldb/Symbol/SymbolVendor.h" #include "JITLoaderGDB.h" diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index e37dde44e234..cb2bb02ec942 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -30,6 +30,7 @@ #include "lldb/Host/FileSpec.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/Symbol.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp index fc592e60d86d..02d3ecd7b3c5 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -12,6 +12,7 @@ #include "lldb/Symbol/FuncUnwinders.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/Thread.h" #include "lldb/Target/Target.h" #include "lldb/Target/Process.h" diff --git a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp index dd81e574d50f..010e3f0bebe4 100644 --- a/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ b/lldb/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -17,6 +17,7 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp index 3d7a9021343a..9ed2f26f7861 100644 --- a/lldb/source/Target/ObjCLanguageRuntime.cpp +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -15,6 +15,7 @@ #include "lldb/Core/Timer.h" #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Target/ObjCLanguageRuntime.h" diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 34e1b65f054c..40f6bdf4015f 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -35,6 +35,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Expression/ClangASTSource.h" #include "lldb/Expression/ClangUserExpression.h" +#include "lldb/Expression/ClangModulesDeclVendor.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/Host.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -54,6 +55,76 @@ using namespace lldb; using namespace lldb_private; +namespace { +// This event data class is for use by the TargetList to broadcast new target notifications. +class TargetEventData : public EventData +{ +public: + TargetEventData(const lldb::TargetSP &new_target_sp) + : EventData() + , m_target_sp(new_target_sp) + { + } + + virtual ~TargetEventData() + { + } + + static const ConstString & + GetFlavorString() + { + static ConstString g_flavor("Target::TargetEventData"); + return g_flavor; + } + + virtual const ConstString & + GetFlavor() const + { + return GetFlavorString(); + } + + lldb::TargetSP & + GetTarget() + { + return m_target_sp; + } + + virtual void + Dump(Stream *s) const + { + } + + static const lldb::TargetSP + GetTargetFromEvent(const lldb::EventSP &event_sp) + { + TargetSP target_sp; + + const TargetEventData *data = GetEventDataFromEvent (event_sp.get()); + if (data) + target_sp = data->m_target_sp; + + return target_sp; + } + + static const TargetEventData * + GetEventDataFromEvent(const Event *event_ptr) + { + if (event_ptr) + { + const EventData *event_data = event_ptr->GetData(); + if (event_data && event_data->GetFlavor() == TargetEventData::GetFlavorString()) + return static_cast (event_ptr->GetData()); + } + return nullptr; + } + +private: + lldb::TargetSP m_target_sp; + + DISALLOW_COPY_AND_ASSIGN (TargetEventData); +}; +} + ConstString & Target::GetStaticBroadcasterClass () { @@ -83,7 +154,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat m_scratch_ast_context_ap (), m_scratch_ast_source_ap (), m_ast_importer_ap (), - m_persistent_variables (), + m_persistent_variables (new ClangPersistentVariables), m_source_manager_ap(), m_stop_hooks (), m_stop_hook_next_id (0), @@ -226,7 +297,7 @@ Target::Destroy() m_last_created_watchpoint.reset(); m_search_filter_sp.reset(); m_image_search_paths.Clear(notify); - m_persistent_variables.Clear(); + m_persistent_variables->Clear(); m_stop_hooks.clear(); m_stop_hook_next_id = 0; m_suppress_stop_hooks = false; @@ -1953,7 +2024,7 @@ Target::EvaluateExpression lldb::ClangExpressionVariableSP persistent_var_sp; // Only check for persistent variables the expression starts with a '$' if (expr_cstr[0] == '$') - persistent_var_sp = m_persistent_variables.GetVariable (expr_cstr); + persistent_var_sp = m_persistent_variables->GetVariable (expr_cstr); if (persistent_var_sp) { @@ -1977,6 +2048,12 @@ Target::EvaluateExpression return execution_results; } +ClangPersistentVariables & +Target::GetPersistentVariables() +{ + return *m_persistent_variables; +} + lldb::addr_t Target::GetCallableLoadAddress (lldb::addr_t load_addr, AddressClass addr_class) const { @@ -2722,6 +2799,12 @@ Target::StopHook::~StopHook () { } +void +Target::StopHook::SetSpecifier(SymbolContextSpecifier *specifier) +{ + m_specifier_sp.reset(specifier); +} + void Target::StopHook::SetThreadSpecifier (ThreadSpec *specifier) { @@ -3521,61 +3604,3 @@ TargetProperties::DisableSTDIOValueChangedCallback(void *target_property_ptr, Op else this_->m_launch_info.GetFlags().Clear(lldb::eLaunchFlagDisableSTDIO); } - -//---------------------------------------------------------------------- -// Target::TargetEventData -//---------------------------------------------------------------------- -const ConstString & -Target::TargetEventData::GetFlavorString () -{ - static ConstString g_flavor ("Target::TargetEventData"); - return g_flavor; -} - -const ConstString & -Target::TargetEventData::GetFlavor () const -{ - return TargetEventData::GetFlavorString (); -} - -Target::TargetEventData::TargetEventData (const lldb::TargetSP &new_target_sp) : - EventData(), - m_target_sp (new_target_sp) -{ -} - -Target::TargetEventData::~TargetEventData() -{ - -} - -void -Target::TargetEventData::Dump (Stream *s) const -{ - -} - -const TargetSP -Target::TargetEventData::GetTargetFromEvent (const lldb::EventSP &event_sp) -{ - TargetSP target_sp; - - const TargetEventData *data = GetEventDataFromEvent (event_sp.get()); - if (data) - target_sp = data->m_target_sp; - - return target_sp; -} - -const Target::TargetEventData * -Target::TargetEventData::GetEventDataFromEvent (const Event *event_ptr) -{ - if (event_ptr) - { - const EventData *event_data = event_ptr->GetData(); - if (event_data && event_data->GetFlavor() == TargetEventData::GetFlavorString()) - return static_cast (event_ptr->GetData()); - } - return NULL; -} - diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 6fd5cdf0d15c..f127ae1b4107 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -21,6 +21,7 @@ #include "lldb/Host/Host.h" #include "lldb/Interpreter/OptionValueFileSpecList.h" #include "lldb/Symbol/Function.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/ObjCLanguageRuntime.h" diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 5a3ebd7b1284..d6c5a5cf7743 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -22,6 +22,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Stream.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 0ded99b3091d..17bd0f7323c8 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -21,6 +21,7 @@ #include "lldb/Symbol/Block.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/Type.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp index 59978c6f8fe6..e97bdd4532d8 100644 --- a/lldb/source/Target/ThreadPlanTracer.cpp +++ b/lldb/source/Target/ThreadPlanTracer.cpp @@ -26,6 +26,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Core/Value.h" #include "lldb/Symbol/TypeList.h" +#include "lldb/Target/ABI.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" #include "lldb/Target/Process.h"