diff options
Diffstat (limited to 'include/lldb')
249 files changed, 2563 insertions, 2147 deletions
diff --git a/include/lldb/API/SBAttachInfo.h b/include/lldb/API/SBAttachInfo.h index 6c3561615990..0c52218f57cd 100644 --- a/include/lldb/API/SBAttachInfo.h +++ b/include/lldb/API/SBAttachInfo.h @@ -86,7 +86,7 @@ public: /// This function implies that a call to SBTarget::Attach(...) will /// be synchronous. /// - /// @param[in] wait_for + /// @param[in] b /// If \b false, attach to an existing process whose name matches. /// If \b true, then wait for the next process whose name matches. //------------------------------------------------------------------ @@ -99,7 +99,7 @@ public: /// Future calls to SBTarget::Attach(...) will be synchronous or /// asynchronous depending on the \a async argument. /// - /// @param[in] wait_for + /// @param[in] b /// If \b false, attach to an existing process whose name matches. /// If \b true, then wait for the next process whose name matches. /// diff --git a/include/lldb/API/SBBreakpoint.h b/include/lldb/API/SBBreakpoint.h index 56509c903c2d..d3f22f39ab00 100644 --- a/include/lldb/API/SBBreakpoint.h +++ b/include/lldb/API/SBBreakpoint.h @@ -133,19 +133,13 @@ private: SBBreakpoint(const lldb::BreakpointSP &bp_sp); - lldb_private::Breakpoint *operator->() const; - - lldb_private::Breakpoint *get() const; - - lldb::BreakpointSP &operator*(); - - const lldb::BreakpointSP &operator*() const; - static bool PrivateBreakpointHitCallback( void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); - lldb::BreakpointSP m_opaque_sp; + lldb::BreakpointSP GetSP() const; + + lldb::BreakpointWP m_opaque_wp; }; class LLDB_API SBBreakpointList { diff --git a/include/lldb/API/SBBreakpointLocation.h b/include/lldb/API/SBBreakpointLocation.h index 344c39c7bfd3..0b5ba79d784f 100644 --- a/include/lldb/API/SBBreakpointLocation.h +++ b/include/lldb/API/SBBreakpointLocation.h @@ -78,8 +78,9 @@ private: friend class SBBreakpoint; void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp); + BreakpointLocationSP GetSP() const; - lldb::BreakpointLocationSP m_opaque_sp; + lldb::BreakpointLocationWP m_opaque_wp; }; } // namespace lldb diff --git a/include/lldb/API/SBFrame.h b/include/lldb/API/SBFrame.h index be5c0920aee5..58339750def6 100644 --- a/include/lldb/API/SBFrame.h +++ b/include/lldb/API/SBFrame.h @@ -78,6 +78,10 @@ public: const char *GetDisplayFunctionName(); const char *GetFunctionName() const; + + // Return the frame function's language. If there isn't a function, then + // guess the language type from the mangled name. + lldb::LanguageType GuessLanguage() const; /// Return true if this frame represents an inlined function. /// diff --git a/include/lldb/API/SBListener.h b/include/lldb/API/SBListener.h index 05282c215406..a2f82a83c3ed 100644 --- a/include/lldb/API/SBListener.h +++ b/include/lldb/API/SBListener.h @@ -89,7 +89,7 @@ protected: SBListener(const lldb::ListenerSP &listener_sp); - lldb::ListenerSP GetSP() { return m_opaque_sp; } + lldb::ListenerSP GetSP(); private: lldb_private::Listener *operator->() const; diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h index 4e8db835ddc0..21341fbc27fa 100644 --- a/include/lldb/API/SBTarget.h +++ b/include/lldb/API/SBTarget.h @@ -124,9 +124,6 @@ public: /// @param[in] envp /// The environment array. /// - /// @param[in] launch_flags - /// Flags to modify the launch (@see lldb::LaunchFlags) - /// /// @param[in] stdin_path /// The path to use when re-directing the STDIN of the new /// process. If all stdXX_path arguments are nullptr, a pseudo @@ -480,6 +477,7 @@ public: /// Resolve a current file address into a section offset address. /// /// @param[in] file_addr + /// The file address to resolve. /// /// @return /// An SBAddress which will be valid if... @@ -653,7 +651,7 @@ public: /// @param[in] source_file /// The file from which to read the breakpoints. /// - /// @param[out] bkpt_list + /// @param[out] new_bps /// A list of the newly created breakpoints. /// /// @return @@ -673,7 +671,7 @@ public: /// Only read in breakpoints whose names match one of the names in this /// list. /// - /// @param[out] bkpt_list + /// @param[out] new_bps /// A list of the newly created breakpoints. /// /// @return diff --git a/include/lldb/API/SBWatchpoint.h b/include/lldb/API/SBWatchpoint.h index 284ec12392a3..92d4851fc14d 100644 --- a/include/lldb/API/SBWatchpoint.h +++ b/include/lldb/API/SBWatchpoint.h @@ -72,7 +72,7 @@ private: friend class SBTarget; friend class SBValue; - lldb::WatchpointSP m_opaque_sp; + std::weak_ptr<lldb_private::Watchpoint> m_opaque_wp; }; } // namespace lldb diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h index 9af6e586de39..4a16df047ee3 100644 --- a/include/lldb/Breakpoint/Breakpoint.h +++ b/include/lldb/Breakpoint/Breakpoint.h @@ -26,8 +26,8 @@ #include "lldb/Breakpoint/Stoppoint.h" #include "lldb/Core/Event.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Core/StringList.h" #include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StringList.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h index 43aef9fc6a27..d0567ccf2e04 100644 --- a/include/lldb/Breakpoint/BreakpointLocation.h +++ b/include/lldb/Breakpoint/BreakpointLocation.h @@ -19,7 +19,7 @@ // Project includes #include "lldb/Breakpoint/StoppointLocation.h" #include "lldb/Core/Address.h" -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h index e053af352ff2..024e915908c0 100644 --- a/include/lldb/Breakpoint/BreakpointOptions.h +++ b/include/lldb/Breakpoint/BreakpointOptions.h @@ -17,9 +17,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Baton.h" -#include "lldb/Core/StringList.h" #include "lldb/Core/StructuredData.h" +#include "lldb/Utility/Baton.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/BreakpointResolver.h b/include/lldb/Breakpoint/BreakpointResolver.h index e19a2135fbd2..7a57250d632b 100644 --- a/include/lldb/Breakpoint/BreakpointResolver.h +++ b/include/lldb/Breakpoint/BreakpointResolver.h @@ -15,12 +15,11 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/Breakpoint.h" -#include "lldb/Breakpoint/BreakpointResolver.h" #include "lldb/Core/Address.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/include/lldb/Breakpoint/BreakpointResolverFileLine.h index f1fdf60e74ec..50750b1fbdf5 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -63,6 +63,8 @@ public: lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override; protected: + void FilterContexts(SymbolContextList &sc_list); + friend class Breakpoint; FileSpec m_file_spec; // This is the file spec we are looking for. uint32_t m_line_number; // This is the line number that we are looking for. diff --git a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index 0429e264774e..6f00dac3f0a7 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointResolver.h" -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/BreakpointSite.h b/include/lldb/Breakpoint/BreakpointSite.h index b334c6e1a276..6e9875615fd9 100644 --- a/include/lldb/Breakpoint/BreakpointSite.h +++ b/include/lldb/Breakpoint/BreakpointSite.h @@ -21,7 +21,7 @@ // Project includes #include "lldb/Breakpoint/BreakpointLocationCollection.h" #include "lldb/Breakpoint/StoppointLocation.h" -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-forward.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/Stoppoint.h b/include/lldb/Breakpoint/Stoppoint.h index 5d131a556ad1..3195ef942d9e 100644 --- a/include/lldb/Breakpoint/Stoppoint.h +++ b/include/lldb/Breakpoint/Stoppoint.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/StoppointLocation.h b/include/lldb/Breakpoint/StoppointLocation.h index ba03b4ea1f5b..f64035bbb941 100644 --- a/include/lldb/Breakpoint/StoppointLocation.h +++ b/include/lldb/Breakpoint/StoppointLocation.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" // #include "lldb/Breakpoint/BreakpointOptions.h" diff --git a/include/lldb/Breakpoint/Watchpoint.h b/include/lldb/Breakpoint/Watchpoint.h index 97f2e282acc2..beb7bad1ee9d 100644 --- a/include/lldb/Breakpoint/Watchpoint.h +++ b/include/lldb/Breakpoint/Watchpoint.h @@ -19,9 +19,9 @@ // Project includes #include "lldb/Breakpoint/StoppointLocation.h" #include "lldb/Breakpoint/WatchpointOptions.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Breakpoint/WatchpointOptions.h b/include/lldb/Breakpoint/WatchpointOptions.h index bfb814ecbd54..6ab1264a1c7f 100644 --- a/include/lldb/Breakpoint/WatchpointOptions.h +++ b/include/lldb/Breakpoint/WatchpointOptions.h @@ -17,8 +17,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Baton.h" -#include "lldb/Core/StringList.h" +#include "lldb/Utility/Baton.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h index 909a0605eae1..a800570ec8b1 100644 --- a/include/lldb/Core/Address.h +++ b/include/lldb/Core/Address.h @@ -10,13 +10,44 @@ #ifndef liblldb_Address_h_ #define liblldb_Address_h_ -// C Includes -// C++ Includes +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-enumerations.h" // for AddressClass::eAddressClassInvalid +#include "lldb/lldb-forward.h" // for SectionWP, SectionSP, ModuleSP +#include "lldb/lldb-types.h" // for addr_t -// Other libraries and framework includes -// Project includes -#include "lldb/Symbol/SymbolContextScope.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, UINT32_MAX, int64_t + +namespace lldb_private { +class Block; +} +namespace lldb_private { +class CompileUnit; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Symbol; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +struct LineEntry; +} namespace lldb_private { diff --git a/include/lldb/Core/AddressRange.h b/include/lldb/Core/AddressRange.h index fa9fefbc0df1..e787d1d5740d 100644 --- a/include/lldb/Core/AddressRange.h +++ b/include/lldb/Core/AddressRange.h @@ -10,11 +10,21 @@ #ifndef liblldb_AddressRange_h_ #define liblldb_AddressRange_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/Address.h" +#include "lldb/lldb-forward.h" // for SectionSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t + +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Target; +} namespace lldb_private { diff --git a/include/lldb/Core/AddressResolver.h b/include/lldb/Core/AddressResolver.h index 5fe2ec1eaec6..432268e497b4 100644 --- a/include/lldb/Core/AddressResolver.h +++ b/include/lldb/Core/AddressResolver.h @@ -10,20 +10,20 @@ #ifndef liblldb_AddressResolver_h_ #define liblldb_AddressResolver_h_ -#include <vector> - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Address.h" #include "lldb/Core/AddressRange.h" -#include "lldb/Core/ConstString.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +#include <stddef.h> // for size_t +#include <vector> namespace lldb_private { +class ModuleList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { //---------------------------------------------------------------------- /// @class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h" diff --git a/include/lldb/Core/AddressResolverFileLine.h b/include/lldb/Core/AddressResolverFileLine.h index 950750e5bfa4..ec15cc76d887 100644 --- a/include/lldb/Core/AddressResolverFileLine.h +++ b/include/lldb/Core/AddressResolverFileLine.h @@ -10,8 +10,22 @@ #ifndef liblldb_AddressResolverFileLine_h_ #define liblldb_AddressResolverFileLine_h_ -// Project includes #include "lldb/Core/AddressResolver.h" +#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::CallbackR... +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} namespace lldb_private { diff --git a/include/lldb/Core/AddressResolverName.h b/include/lldb/Core/AddressResolverName.h index e93d16fbc6aa..aadc05495999 100644 --- a/include/lldb/Core/AddressResolverName.h +++ b/include/lldb/Core/AddressResolverName.h @@ -10,10 +10,21 @@ #ifndef liblldb_AddressResolverName_h_ #define liblldb_AddressResolverName_h_ -// Project includes - #include "lldb/Core/AddressResolver.h" -#include "lldb/Core/RegularExpression.h" +#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::Call... +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/RegularExpression.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} namespace lldb_private { diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Core/ArchSpec.h index 7f663f7abd12..648815c21371 100644 --- a/include/lldb/Core/ArchSpec.h +++ b/include/lldb/Core/ArchSpec.h @@ -12,13 +12,31 @@ #if defined(__cplusplus) -#include "lldb/Core/ConstString.h" -#include "lldb/lldb-forward.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-private-enumerations.h" +#include "llvm/ADT/StringRef.h" // for StringRef #include "llvm/ADT/Triple.h" +#include <string> // for string + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Platform; +} namespace lldb_private { +class Stream; +} +namespace lldb_private { +class StringList; +} +namespace lldb_private { +class Thread; +} -struct CoreDefinition; +namespace lldb_private { //---------------------------------------------------------------------- /// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h" @@ -307,7 +325,7 @@ public: /// @return A string representing target CPU for the current /// architecture. //------------------------------------------------------------------ - std::string GetClangTargetCPU(); + std::string GetClangTargetCPU() const; //------------------------------------------------------------------ /// Return a string representing target application ABI. diff --git a/include/lldb/Core/Broadcaster.h b/include/lldb/Core/Broadcaster.h index c23f12c30b9c..825287db5984 100644 --- a/include/lldb/Core/Broadcaster.h +++ b/include/lldb/Core/Broadcaster.h @@ -10,21 +10,33 @@ #ifndef liblldb_Broadcaster_h_ #define liblldb_Broadcaster_h_ -// C Includes -// C++ Includes -#include <functional> -#include <list> +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for ListenerSP, EventSP, Broadcast... + +#include "llvm/ADT/SmallVector.h" + +#include <cstdint> // for uint32_t, UINT32_MAX #include <map> +#include <memory> // for shared_ptr, operator==, enable... #include <mutex> +#include <set> // for set #include <string> +#include <utility> // for pair #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/lldb-private.h" - -#include "llvm/ADT/SmallVector.h" +namespace lldb_private { +class Broadcaster; +} +namespace lldb_private { +class EventData; +} +namespace lldb_private { +class Listener; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { @@ -82,8 +94,8 @@ protected: public: // Listeners hold onto weak pointers to their broadcaster managers. So they - // must be - // made into shared pointers, which you do with MakeBroadcasterManager. + // must be made into shared pointers, which you do with + // MakeBroadcasterManager. static lldb::BroadcasterManagerSP MakeBroadcasterManager(); diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h index 8a875ddad1f8..9459573ca90e 100644 --- a/include/lldb/Core/Communication.h +++ b/include/lldb/Core/Communication.h @@ -10,19 +10,31 @@ #ifndef liblldb_Communication_h_ #define liblldb_Communication_h_ -// C Includes -// C++ Includes +#include "lldb/Core/Broadcaster.h" +#include "lldb/Host/HostThread.h" +#include "lldb/Utility/Timeout.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ConnectionStatus, FLAGS_ANONYMOU... +#include "lldb/lldb-forward.h" // for ConnectionSP +#include "lldb/lldb-types.h" // for thread_arg_t, thread_result_t + #include <atomic> #include <mutex> +#include <ratio> // for micro #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Broadcaster.h" -#include "lldb/Core/Error.h" -#include "lldb/Host/HostThread.h" -#include "lldb/Utility/Timeout.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint8_t + +namespace lldb_private { +class Connection; +} +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class Error; +} namespace lldb_private { diff --git a/include/lldb/Core/Connection.h b/include/lldb/Core/Connection.h index 6ff7b001a709..8d84377e3757 100644 --- a/include/lldb/Core/Connection.h +++ b/include/lldb/Core/Connection.h @@ -10,15 +10,24 @@ #ifndef liblldb_Connection_h_ #define liblldb_Connection_h_ -// Other libraries and framework includes -// Project includes -#include "lldb/Utility/Timeout.h" -#include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ConnectionStatus +#include "lldb/lldb-forward.h" // for IOObjectSP -// C Includes -// C++ Includes +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <ratio> // for micro #include <string> +#include <stddef.h> // for size_t + +namespace lldb_private { +class Error; +} +namespace lldb_private { +template <typename Ratio> class Timeout; +} + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Core/DataBufferMemoryMap.h b/include/lldb/Core/DataBufferMemoryMap.h deleted file mode 100644 index 1b8277b50488..000000000000 --- a/include/lldb/Core/DataBufferMemoryMap.h +++ /dev/null @@ -1,154 +0,0 @@ -//===-- DataBufferMemoryMap.h -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_DataBufferMemoryMap_h_ -#define liblldb_DataBufferMemoryMap_h_ - -#include "lldb/Core/DataBuffer.h" -#include "lldb/Core/Error.h" -#include "lldb/lldb-private.h" -#include <string> - -namespace lldb_private { - -//---------------------------------------------------------------------- -/// @class DataBufferMemoryMap DataBufferMemoryMap.h -/// "lldb/Core/DataBufferMemoryMap.h" -/// @brief A subclass of DataBuffer that memory maps data. -/// -/// This class memory maps data and stores any needed data for the -/// memory mapping in its internal state. Memory map requests are not -/// required to have any alignment or size constraints, this class will -/// work around any host OS issues regarding such things. -/// -/// This class is designed to allow pages to be faulted in as needed and -/// works well data from large files that won't be accessed all at once. -//---------------------------------------------------------------------- -class DataBufferMemoryMap : public DataBuffer { -public: - //------------------------------------------------------------------ - /// Default Constructor - //------------------------------------------------------------------ - DataBufferMemoryMap(); - - //------------------------------------------------------------------ - /// Destructor. - /// - /// Virtual destructor since this class inherits from a pure virtual - /// base class #DataBuffer. - //------------------------------------------------------------------ - ~DataBufferMemoryMap() override; - - //------------------------------------------------------------------ - /// Reverts this object to an empty state by unmapping any memory - /// that is currently owned. - //------------------------------------------------------------------ - void Clear(); - - //------------------------------------------------------------------ - /// @copydoc DataBuffer::GetBytes() - //------------------------------------------------------------------ - uint8_t *GetBytes() override; - - //------------------------------------------------------------------ - /// @copydoc DataBuffer::GetBytes() const - //------------------------------------------------------------------ - const uint8_t *GetBytes() const override; - - //------------------------------------------------------------------ - /// @copydoc DataBuffer::GetByteSize() const - //------------------------------------------------------------------ - lldb::offset_t GetByteSize() const override; - - //------------------------------------------------------------------ - /// Error get accessor. - /// - /// @return - /// A const reference to Error object in case memory mapping - /// fails. - //------------------------------------------------------------------ - const Error &GetError() const; - - //------------------------------------------------------------------ - /// Memory map all or part of a file. - /// - /// Memory map \a length bytes from \a file starting \a offset - /// bytes into the file. If \a length is set to \c SIZE_MAX, - /// then map as many bytes as possible. - /// - /// @param[in] file - /// The file specification from which to map data. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. Even though it may be possible - /// for a 32-bit host debugger to debug a 64-bit target, size_t - /// still dictates the maximum possible size that can be mapped - /// into this process. For this kind of cross-arch debugging - /// scenario, mappings and views should be managed at a higher - /// level. - /// - /// @return - /// The number of bytes mapped starting from the \a offset. - //------------------------------------------------------------------ - size_t MemoryMapFromFileSpec(const FileSpec *file, lldb::offset_t offset = 0, - size_t length = SIZE_MAX, - bool writeable = false); - - //------------------------------------------------------------------ - /// Memory map all or part of a file. - /// - /// Memory map \a length bytes from an opened file descriptor \a fd - /// starting \a offset bytes into the file. If \a length is set to - /// \c SIZE_MAX, then map as many bytes as possible. - /// - /// @param[in] fd - /// The posix file descriptor for an already opened file - /// from which to map data. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// The number of bytes mapped starting from the \a offset. - //------------------------------------------------------------------ - size_t MemoryMapFromFileDescriptor(int fd, lldb::offset_t offset, - size_t length, bool write, - bool fd_is_file); - -protected: - //------------------------------------------------------------------ - // Classes that inherit from DataBufferMemoryMap can see and modify these - //------------------------------------------------------------------ - uint8_t *m_mmap_addr; ///< The actual pointer that was returned from \c mmap() - size_t m_mmap_size; ///< The actual number of bytes that were mapped when \c - ///mmap() was called - uint8_t *m_data; ///< The data the user requested somewhere within the memory - ///mapped data. - lldb::offset_t - m_size; ///< The size of the data the user got when data was requested - -private: - DISALLOW_COPY_AND_ASSIGN(DataBufferMemoryMap); -}; - -} // namespace lldb_private - -#endif // liblldb_DataBufferMemoryMap_h_ diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h index ccc07b30f0c6..56201273fdd2 100644 --- a/include/lldb/Core/Debugger.h +++ b/include/lldb/Core/Debugger.h @@ -14,9 +14,7 @@ #include <stdint.h> // C++ Includes -#include <map> #include <memory> -#include <mutex> #include <vector> // Other libraries and framework includes @@ -24,21 +22,55 @@ #include "lldb/Core/Broadcaster.h" #include "lldb/Core/FormatEntity.h" #include "lldb/Core/IOHandler.h" -#include "lldb/Core/Listener.h" #include "lldb/Core/SourceManager.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/Terminal.h" +#include "lldb/Target/ExecutionContext.h" // for ExecutionContext #include "lldb/Target/Platform.h" #include "lldb/Target/TargetList.h" -#include "lldb/lldb-public.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/UserID.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ScriptLanguage, Langua... +#include "lldb/lldb-forward.h" // for StreamFileSP, DebuggerSP +#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType +#include "lldb/lldb-private-types.h" // for LoadPluginCallbackType +#include "lldb/lldb-types.h" // for LogOutputCallback, thr... + +#include "llvm/ADT/ArrayRef.h" // for ArrayRef +#include "llvm/ADT/StringMap.h" // for StringMap +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/DynamicLibrary.h" // for DynamicLibrary +#include "llvm/Support/Threading.h" + +#include <assert.h> // for assert +#include <stddef.h> // for size_t +#include <stdio.h> +namespace lldb_private { +class Address; +} +namespace lldb_private { +class CommandInterpreter; +} +namespace lldb_private { +class Process; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class Target; +} namespace llvm { -namespace sys { -class DynamicLibrary; -} // namespace sys -} // namespace llvm +class raw_ostream; +} namespace lldb_private { @@ -190,9 +222,10 @@ public: void SetCloseInputOnEOF(bool b); - bool EnableLog(const char *channel, const char **categories, - const char *log_file, uint32_t log_options, - Stream &error_stream); + bool EnableLog(llvm::StringRef channel, + llvm::ArrayRef<const char *> categories, + llvm::StringRef log_file, uint32_t log_options, + llvm::raw_ostream &error_stream); void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); @@ -363,9 +396,8 @@ protected: std::unique_ptr<CommandInterpreter> m_command_interpreter_ap; IOHandlerStack m_input_reader_stack; - typedef std::map<std::string, lldb::StreamWP> LogStreamMap; - LogStreamMap m_log_streams; - lldb::StreamSP m_log_callback_stream_sp; + llvm::StringMap<std::weak_ptr<llvm::raw_ostream>> m_log_streams; + std::shared_ptr<llvm::raw_ostream> m_log_callback_stream_sp; ConstString m_instance_name; static LoadPluginCallbackType g_load_plugin_callback; typedef std::vector<llvm::sys::DynamicLibrary> LoadedPluginsList; @@ -374,7 +406,7 @@ protected: HostThread m_io_handler_thread; Broadcaster m_sync_broadcaster; lldb::ListenerSP m_forward_listener_sp; - std::once_flag m_clear_once; + llvm::once_flag m_clear_once; //---------------------------------------------------------------------- // Events for m_sync_broadcaster diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h index c42074719b1a..929b668c092b 100644 --- a/include/lldb/Core/Disassembler.h +++ b/include/lldb/Core/Disassembler.h @@ -10,22 +10,68 @@ #ifndef liblldb_Disassembler_h_ #define liblldb_Disassembler_h_ -// C Includes -// C++ Includes -#include <string> -#include <vector> - -// Other libraries and framework includes -// Project includes #include "lldb/Core/Address.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/EmulateInstruction.h" +#include "lldb/Core/FormatEntity.h" // for FormatEntity #include "lldb/Core/Opcode.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Symbol/LineEntry.h" -#include "lldb/lldb-private.h" +#include "lldb/Target/ExecutionContext.h" // for ExecutionContext +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for AddressClass, AddressClass... +#include "lldb/lldb-forward.h" // for InstructionSP, DisassemblerSP +#include "lldb/lldb-types.h" // for addr_t, offset_t + +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <functional> // for function +#include <map> +#include <memory> // for enable_shared_from_this +#include <set> +#include <string> +#include <vector> + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int64_t +#include <stdio.h> // for FILE + +namespace lldb_private { +class AddressRange; +} +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Debugger; +} +namespace lldb_private { +class Disassembler; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +struct RegisterInfo; +} +namespace llvm { +template <typename T> class SmallVectorImpl; +} namespace lldb_private { diff --git a/include/lldb/Core/DumpDataExtractor.h b/include/lldb/Core/DumpDataExtractor.h new file mode 100644 index 000000000000..46e676c239d1 --- /dev/null +++ b/include/lldb/Core/DumpDataExtractor.h @@ -0,0 +1,95 @@ +//===-- DumpDataExtractor.h -------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_CORE_DUMPDATAEXTRACTOR_H +#define LLDB_CORE_DUMPDATAEXTRACTOR_H + +#include "lldb/lldb-enumerations.h" // for Format +#include "lldb/lldb-types.h" + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class DataExtractor; +class ExecutionContextScope; +class Stream; + +//------------------------------------------------------------------ +/// Dumps \a item_count objects into the stream \a s. +/// +/// Dumps \a item_count objects using \a item_format, each of which +/// are \a item_byte_size bytes long starting at offset \a offset +/// bytes into the contained data, into the stream \a s. \a +/// num_per_line objects will be dumped on each line before a new +/// line will be output. If \a base_addr is a valid address, then +/// each new line of output will be preceded by the address value +/// plus appropriate offset, and a colon and space. Bitfield values +/// can be dumped by calling this function multiple times with the +/// same start offset, format and size, yet differing \a +/// item_bit_size and \a item_bit_offset values. +/// +/// @param[in] s +/// The stream to dump the output to. This value can not be nullptr. +/// +/// @param[in] offset +/// The offset into the data at which to start dumping. +/// +/// @param[in] item_format +/// The format to use when dumping each item. +/// +/// @param[in] item_byte_size +/// The byte size of each item. +/// +/// @param[in] item_count +/// The number of items to dump. +/// +/// @param[in] num_per_line +/// The number of items to display on each line. +/// +/// @param[in] base_addr +/// The base address that gets added to the offset displayed on +/// each line if the value is valid. Is \a base_addr is +/// LLDB_INVALID_ADDRESS then no address values will be prepended +/// to any lines. +/// +/// @param[in] item_bit_size +/// If the value to display is a bitfield, this value should +/// be the number of bits that the bitfield item has within the +/// item's byte size value. This function will need to be called +/// multiple times with identical \a offset and \a item_byte_size +/// values in order to display multiple bitfield values that +/// exist within the same integer value. If the items being +/// displayed are not bitfields, this value should be zero. +/// +/// @param[in] item_bit_offset +/// If the value to display is a bitfield, this value should +/// be the offset in bits, or shift right amount, that the +/// bitfield item occupies within the item's byte size value. +/// This function will need to be called multiple times with +/// identical \a offset and \a item_byte_size values in order +/// to display multiple bitfield values that exist within the +/// same integer value. If the items being displayed are not +/// bitfields, this value should be zero. +/// +/// @return +/// The offset at which dumping ended. +//------------------------------------------------------------------ +lldb::offset_t +DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset, + lldb::Format item_format, size_t item_byte_size, + size_t item_count, size_t num_per_line, uint64_t base_addr, + uint32_t item_bit_size, uint32_t item_bit_offset, + ExecutionContextScope *exe_scope = nullptr); + +void DumpHexBytes(Stream *s, const void *src, size_t src_len, + uint32_t bytes_per_line, lldb::addr_t base_addr); +} + +#endif diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h index 90e66d668ca4..bfc9ef054d7a 100644 --- a/include/lldb/Core/EmulateInstruction.h +++ b/include/lldb/Core/EmulateInstruction.h @@ -15,9 +15,34 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Opcode.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/RegisterValue.h" -#include "lldb/lldb-private.h" -#include "lldb/lldb-public.h" + +#include "lldb/Core/Address.h" // for Address +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for RegisterKind, ByteOrder +#include "lldb/lldb-private-enumerations.h" // for InstructionType +#include "lldb/lldb-private-types.h" // for RegisterInfo +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int64_t +namespace lldb_private { +class OptionValueDictionary; +} +namespace lldb_private { +class RegisterContext; +} +namespace lldb_private { +class RegisterValue; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +class UnwindPlan; +} namespace lldb_private { diff --git a/include/lldb/Core/Event.h b/include/lldb/Core/Event.h index 049bb3cec224..5d297a719e73 100644 --- a/include/lldb/Core/Event.h +++ b/include/lldb/Core/Event.h @@ -10,19 +10,28 @@ #ifndef liblldb_Event_h_ #define liblldb_Event_h_ -// C Includes -// C++ Includes +#include "lldb/Core/Broadcaster.h" +#include "lldb/Core/StructuredData.h" +#include "lldb/Host/Predicate.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for EventDataSP, ProcessSP, Struct... + +#include "llvm/ADT/StringRef.h" // for StringRef + #include <chrono> #include <memory> #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Broadcaster.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/StructuredData.h" -#include "lldb/Host/Predicate.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Event; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Core/FileLineResolver.h b/include/lldb/Core/FileLineResolver.h index e9e20c59f93f..54bce4fd2f41 100644 --- a/include/lldb/Core/FileLineResolver.h +++ b/include/lldb/Core/FileLineResolver.h @@ -10,9 +10,19 @@ #ifndef liblldb_FileLineResolver_h_ #define liblldb_FileLineResolver_h_ -// Project includes -#include "lldb/Core/AddressResolver.h" +#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::CallbackR... #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +#include <stdint.h> // for uint32_t, UINT32_MAX + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Core/FileSpecList.h b/include/lldb/Core/FileSpecList.h index 75995d1ca9fb..3cbffca44f69 100644 --- a/include/lldb/Core/FileSpecList.h +++ b/include/lldb/Core/FileSpecList.h @@ -11,10 +11,16 @@ #define liblldb_FileSpecList_h_ #if defined(__cplusplus) -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/FileSpec.h" + #include <vector> +#include <stddef.h> // for size_t + +namespace lldb_private { +class Stream; +} + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h index b6fe9ea46bfc..6705c155cefc 100644 --- a/include/lldb/Core/FormatEntity.h +++ b/include/lldb/Core/FormatEntity.h @@ -10,19 +10,38 @@ #ifndef liblldb_FormatEntity_h_ #define liblldb_FormatEntity_h_ -// C Includes -// C++ Includes +#include "lldb/Utility/Error.h" +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-enumerations.h" // for Format::eFormatDefault, Format +#include "lldb/lldb-types.h" // for addr_t +#include <algorithm> // for min +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + #include <string> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Error.h" -#include "lldb/lldb-private.h" - +namespace lldb_private { +class Address; +} +namespace lldb_private { +class ExecutionContext; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class StringList; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class ValueObject; +} namespace llvm { class StringRef; -} // namespace llvm +} namespace lldb_private { class FormatEntity { diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h index 2e6ff31ee687..ebf56d7908b4 100644 --- a/include/lldb/Core/IOHandler.h +++ b/include/lldb/Core/IOHandler.h @@ -10,26 +10,27 @@ #ifndef liblldb_IOHandler_h_ #define liblldb_IOHandler_h_ -// C Includes -#include <string.h> +#include "lldb/Core/ValueObjectList.h" +#include "lldb/Host/Predicate.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Flags.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for IOHandlerSP, StreamFileSP +#include "llvm/ADT/StringRef.h" // for StringRef -// C++ Includes #include <memory> #include <mutex> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Flags.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" -#include "lldb/Core/ValueObjectList.h" -#include "lldb/Host/Predicate.h" -#include "lldb/lldb-enumerations.h" -#include "lldb/lldb-public.h" +#include <stdint.h> // for uint32_t +#include <stdio.h> // for FILE + +namespace lldb_private { +class Debugger; +} namespace curses { class Application; diff --git a/include/lldb/Core/Listener.h b/include/lldb/Core/Listener.h index b82844eabbb8..3d12f8fb3391 100644 --- a/include/lldb/Core/Listener.h +++ b/include/lldb/Core/Listener.h @@ -10,20 +10,29 @@ #ifndef liblldb_Select_h_ #define liblldb_Select_h_ -// C Includes -// C++ Includes -#include <chrono> +#include "lldb/Core/Broadcaster.h" // for Broadcaster::BroadcasterImplWP +#include "lldb/Utility/Timeout.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for BroadcasterManagerWP, EventSP + +#include <condition_variable> #include <list> #include <map> +#include <memory> // for owner_less, enable_shared_from_this #include <mutex> +#include <ratio> // for micro #include <string> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Event.h" -#include "lldb/Utility/Timeout.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class Event; +} namespace lldb_private { @@ -39,8 +48,7 @@ public: //------------------------------------------------------------------ // // Listeners have to be constructed into shared pointers - at least if you - // want them to listen to - // Broadcasters, + // want them to listen to Broadcasters, protected: Listener(const char *name); diff --git a/include/lldb/Core/Log.h b/include/lldb/Core/Log.h deleted file mode 100644 index d87c263a427c..000000000000 --- a/include/lldb/Core/Log.h +++ /dev/null @@ -1,189 +0,0 @@ -//===-- Log.h ---------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_Log_h_ -#define liblldb_Log_h_ - -// C Includes -#include <signal.h> -#include <stdarg.h> -#include <stdint.h> -#include <stdio.h> - -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Flags.h" -#include "lldb/Core/Logging.h" -#include "lldb/Core/PluginInterface.h" -#include "lldb/lldb-private.h" - -#include "llvm/Support/FormatVariadic.h" - -//---------------------------------------------------------------------- -// Logging Options -//---------------------------------------------------------------------- -#define LLDB_LOG_OPTION_THREADSAFE (1u << 0) -#define LLDB_LOG_OPTION_VERBOSE (1u << 1) -#define LLDB_LOG_OPTION_DEBUG (1u << 2) -#define LLDB_LOG_OPTION_PREPEND_SEQUENCE (1u << 3) -#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP (1u << 4) -#define LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD (1u << 5) -#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME (1U << 6) -#define LLDB_LOG_OPTION_BACKTRACE (1U << 7) -#define LLDB_LOG_OPTION_APPEND (1U << 8) - -//---------------------------------------------------------------------- -// Logging Functions -//---------------------------------------------------------------------- -namespace lldb_private { - -class Log final { -public: - //------------------------------------------------------------------ - // Callback definitions for abstracted plug-in log access. - //------------------------------------------------------------------ - typedef void (*DisableCallback)(const char **categories, - Stream *feedback_strm); - typedef Log *(*EnableCallback)(lldb::StreamSP &log_stream_sp, - uint32_t log_options, const char **categories, - Stream *feedback_strm); - typedef void (*ListCategoriesCallback)(Stream *strm); - - struct Callbacks { - DisableCallback disable; - EnableCallback enable; - ListCategoriesCallback list_categories; - }; - - //------------------------------------------------------------------ - // Static accessors for logging channels - //------------------------------------------------------------------ - static void RegisterLogChannel(const ConstString &channel, - const Log::Callbacks &log_callbacks); - - static bool UnregisterLogChannel(const ConstString &channel); - - static bool GetLogChannelCallbacks(const ConstString &channel, - Log::Callbacks &log_callbacks); - - static bool EnableLogChannel(lldb::StreamSP &log_stream_sp, - uint32_t log_options, const char *channel, - const char **categories, Stream &error_stream); - - static void EnableAllLogChannels(lldb::StreamSP &log_stream_sp, - uint32_t log_options, - const char **categories, - Stream *feedback_strm); - - static void DisableAllLogChannels(Stream *feedback_strm); - - static void ListAllLogChannels(Stream *strm); - - static void Initialize(); - - static void Terminate(); - - //------------------------------------------------------------------ - // Auto completion - //------------------------------------------------------------------ - static void AutoCompleteChannelName(const char *channel_name, - StringList &matches); - - //------------------------------------------------------------------ - // Member functions - //------------------------------------------------------------------ - Log(); - - Log(const lldb::StreamSP &stream_sp); - - ~Log(); - - void PutCString(const char *cstr); - void PutString(llvm::StringRef str); - - template <typename... Args> void Format(const char *fmt, Args &&... args) { - PutString(llvm::formatv(fmt, std::forward<Args>(args)...).str()); - } - - // CLEANUP: Add llvm::raw_ostream &Stream() function. - void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); - - void VAPrintf(const char *format, va_list args); - - void LogIf(uint32_t mask, const char *fmt, ...) - __attribute__((format(printf, 3, 4))); - - void Debug(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - void VAError(const char *format, va_list args); - - void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - void Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - Flags &GetOptions(); - - const Flags &GetOptions() const; - - Flags &GetMask(); - - const Flags &GetMask() const; - - bool GetVerbose() const; - - bool GetDebug() const; - - void SetStream(const lldb::StreamSP &stream_sp) { m_stream_sp = stream_sp; } - -protected: - //------------------------------------------------------------------ - // Member variables - //------------------------------------------------------------------ - lldb::StreamSP m_stream_sp; - Flags m_options; - Flags m_mask_bits; - -private: - DISALLOW_COPY_AND_ASSIGN(Log); -}; - -class LogChannel : public PluginInterface { -public: - LogChannel(); - - ~LogChannel() override; - - static lldb::LogChannelSP FindPlugin(const char *plugin_name); - - // categories is an array of chars that ends with a NULL element. - virtual void Disable(const char **categories, Stream *feedback_strm) = 0; - - virtual bool - Enable(lldb::StreamSP &log_stream_sp, uint32_t log_options, - Stream *feedback_strm, // Feedback stream for argument errors etc - const char **categories) = 0; // The categories to enable within this - // logging stream, if empty, enable - // default set - - virtual void ListCategories(Stream *strm) = 0; - -protected: - std::unique_ptr<Log> m_log_ap; - -private: - DISALLOW_COPY_AND_ASSIGN(LogChannel); -}; - -} // namespace lldb_private - -#endif // liblldb_Log_h_ diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h index 4170b708013e..22778fabe63d 100644 --- a/include/lldb/Core/Mangled.h +++ b/include/lldb/Core/Mangled.h @@ -11,9 +11,18 @@ #define liblldb_Mangled_h_ #if defined(__cplusplus) -#include "lldb/Core/ConstString.h" -#include "lldb/lldb-private.h" -#include <vector> +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-enumerations.h" // for LanguageType +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <stddef.h> // for size_t + +namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h index 842a116d07a8..cab98ee5b302 100644 --- a/include/lldb/Core/MappedHash.h +++ b/include/lldb/Core/MappedHash.h @@ -22,8 +22,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Stream.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Stream.h" class MappedHash { public: @@ -353,7 +353,7 @@ public: bool IsValid() const { return m_header.version == 1 && m_header.hash_function == eHashFunctionDJB && - m_header.bucket_count > 0 && m_header.hashes_count > 0; + m_header.bucket_count > 0; } uint32_t GetHashIndex(uint32_t bucket_idx) const { diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 90d75b623732..ca47a38a2ef5 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -10,29 +10,86 @@ #ifndef liblldb_Module_h_ #define liblldb_Module_h_ -#include "lldb/Symbol/SymbolContextScope.h" - -// Project includes +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/UUID.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Core/ModuleSpec.h" // for ModuleSpec +#include "lldb/Symbol/SymbolContextScope.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/PathMappingList.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/UUID.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for LanguageType, SymbolType #include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" // for addr_t, offset_t -// Other libraries and framework includes #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Chrono.h" -// C Includes -// C++ Includes #include <atomic> +#include <memory> // for enable_shared_from_this #include <mutex> +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t #include <string> #include <vector> namespace lldb_private { +class CompilerDeclContext; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class Log; +} +namespace lldb_private { +class ObjectFile; +} +namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Symbol; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class SymbolFile; +} +namespace lldb_private { +class SymbolVendor; +} +namespace lldb_private { +class Symtab; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +class TypeList; +} +namespace lldb_private { +class TypeMap; +} +namespace lldb_private { +class VariableList; +} + +namespace lldb_private { //---------------------------------------------------------------------- /// @class Module Module.h "lldb/Core/Module.h" @@ -962,6 +1019,20 @@ public: bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const; bool RemapSourceFile(const char *, std::string &) const = delete; + //------------------------------------------------------------------ + /// Loads this module to memory. + /// + /// Loads the bits needed to create an executable image to the memory. + /// It is useful with bare-metal targets where target does not have the + /// ability to start a process itself. + /// + /// @param[in] target + /// Target where to load the module. + /// + /// @return + //------------------------------------------------------------------ + Error LoadInMemory(Target &target, bool set_pc); + //---------------------------------------------------------------------- /// @class LookupInfo Module.h "lldb/Core/Module.h" /// @brief A class that encapsulates name lookup information. diff --git a/include/lldb/Core/ModuleChild.h b/include/lldb/Core/ModuleChild.h index f47c5ca135e6..8f2985c8185b 100644 --- a/include/lldb/Core/ModuleChild.h +++ b/include/lldb/Core/ModuleChild.h @@ -10,7 +10,7 @@ #ifndef liblldb_ModuleChild_h_ #define liblldb_ModuleChild_h_ -#include "lldb/lldb-private.h" +#include "lldb/lldb-forward.h" namespace lldb_private { diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h index 4aa16740bd74..d82d1c0d48d8 100644 --- a/include/lldb/Core/ModuleList.h +++ b/include/lldb/Core/ModuleList.h @@ -10,18 +10,67 @@ #ifndef liblldb_ModuleList_h_ #define liblldb_ModuleList_h_ -// C Includes -// C++ Includes +#include "lldb/Core/Address.h" // for Address +#include "lldb/Core/ModuleSpec.h" // for ModuleSpec +#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Iterable.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" + +#include "llvm/ADT/DenseSet.h" + #include <functional> #include <list> #include <mutex> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Utility/Iterable.h" -#include "lldb/lldb-private.h" -#include "llvm/ADT/DenseSet.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class FileSpecList; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class SymbolFile; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +class TypeList; +} +namespace lldb_private { +class UUID; +} +namespace lldb_private { +class VariableList; +} namespace lldb_private { diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h index 6a9e60482b91..ce851d8af5fc 100644 --- a/include/lldb/Core/ModuleSpec.h +++ b/include/lldb/Core/ModuleSpec.h @@ -12,10 +12,10 @@ // Project includes #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/UUID.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Target/PathMappingList.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/UUID.h" // Other libraries and framework includes #include "llvm/Support/Chrono.h" diff --git a/include/lldb/Core/Opcode.h b/include/lldb/Core/Opcode.h index d5376d44b814..33857457b2c4 100644 --- a/include/lldb/Core/Opcode.h +++ b/include/lldb/Core/Opcode.h @@ -10,20 +10,25 @@ #ifndef lldb_Opcode_h #define lldb_Opcode_h -// C Includes -#include <string.h> +#include "lldb/Utility/Endian.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder, ByteOrder::eByteOrde... -// C++ Includes -// Other libraries and framework includes #include "llvm/Support/MathExtras.h" -// Project includes -#include "lldb/Host/Endian.h" -#include "lldb/lldb-public.h" +#include <assert.h> // for assert +#include <stdint.h> // for uint32_t, uint8_t, uint16_t +#include <string.h> + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Stream; +} namespace lldb { class SBInstruction; -} // namespace lldb +} namespace lldb_private { diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h index e0de65a6bf16..645ab85eaa7e 100644 --- a/include/lldb/Core/PluginManager.h +++ b/include/lldb/Core/PluginManager.h @@ -10,13 +10,28 @@ #ifndef liblldb_PluginManager_h_ #define liblldb_PluginManager_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/Error.h" // for Error +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-enumerations.h" // for ScriptLanguage +#include "lldb/lldb-forward.h" // for OptionValuePropertiesSP +#include "lldb/lldb-private-interfaces.h" // for DebuggerInitializeCallback +#include "llvm/ADT/StringRef.h" // for StringRef +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class CommandInterpreter; +} +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class Debugger; +} +namespace lldb_private { +class StringList; +} namespace lldb_private { class PluginManager { @@ -210,22 +225,6 @@ public: GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx); //------------------------------------------------------------------ - // LogChannel - //------------------------------------------------------------------ - static bool RegisterPlugin(const ConstString &name, const char *description, - LogChannelCreateInstance create_callback); - - static bool UnregisterPlugin(LogChannelCreateInstance create_callback); - - static LogChannelCreateInstance - GetLogChannelCreateCallbackAtIndex(uint32_t idx); - - static LogChannelCreateInstance - GetLogChannelCreateCallbackForPluginName(const ConstString &name); - - static const char *GetLogChannelCreateNameAtIndex(uint32_t idx); - - //------------------------------------------------------------------ // Platform //------------------------------------------------------------------ static bool diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h index 73a949fcd25f..e37dcd7df443 100644 --- a/include/lldb/Core/RangeMap.h +++ b/include/lldb/Core/RangeMap.h @@ -59,6 +59,18 @@ template <typename B, typename S> struct Range { void Slide(BaseType slide) { base += slide; } + bool Union(const Range &rhs) + { + if (DoesAdjoinOrIntersect(rhs)) + { + auto new_end = std::max<BaseType>(GetRangeEnd(), rhs.GetRangeEnd()); + base = std::min<BaseType>(base, rhs.base); + size = new_end - base; + return true; + } + return false; + } + BaseType GetRangeEnd() const { return base + size; } void SetRangeEnd(BaseType end) { @@ -348,7 +360,33 @@ public: void Append(B base, S size) { m_entries.emplace_back(base, size); } - bool RemoveEntrtAtIndex(uint32_t idx) { + // Insert an item into a sorted list and optionally combine it with any + // adjacent blocks if requested. + void Insert(const Entry &entry, bool combine) { + if (m_entries.empty()) { + m_entries.push_back(entry); + return; + } + auto begin = m_entries.begin(); + auto end = m_entries.end(); + auto pos = std::lower_bound(begin, end, entry); + if (combine) { + if (pos != end && pos->Union(entry)) { + CombinePrevAndNext(pos); + return; + } + if (pos != begin) { + auto prev = pos - 1; + if (prev->Union(entry)) { + CombinePrevAndNext(prev); + return; + } + } + } + m_entries.insert(pos, entry); + } + + bool RemoveEntryAtIndex(uint32_t idx) { if (idx < m_entries.size()) { m_entries.erase(m_entries.begin() + idx); return true; @@ -458,6 +496,7 @@ public: // Clients must ensure that "i" is a valid index prior to calling this // function + Entry &GetEntryRef(size_t i) { return m_entries[i]; } const Entry &GetEntryRef(size_t i) const { return m_entries[i]; } Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); } @@ -538,6 +577,28 @@ public: } protected: + + void CombinePrevAndNext(typename Collection::iterator pos) { + // Check if the prev or next entries in case they need to be unioned with + // the entry pointed to by "pos". + if (pos != m_entries.begin()) { + auto prev = pos - 1; + if (prev->Union(*pos)) + m_entries.erase(pos); + pos = prev; + } + + auto end = m_entries.end(); + if (pos != end) { + auto next = pos + 1; + if (next != end) { + if (pos->Union(*next)) + m_entries.erase(next); + } + } + return; + } + Collection m_entries; }; diff --git a/include/lldb/Core/RegisterValue.h b/include/lldb/Core/RegisterValue.h index 78dfbea97032..66c4689d702d 100644 --- a/include/lldb/Core/RegisterValue.h +++ b/include/lldb/Core/RegisterValue.h @@ -10,20 +10,28 @@ #ifndef lldb_RegisterValue_h #define lldb_RegisterValue_h -// C Includes -#include <string.h> +#include "lldb/Core/Scalar.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/Error.h" // for Error +#include "lldb/lldb-enumerations.h" // for ByteOrder, Format +#include "lldb/lldb-types.h" // for offset_t -// C++ Includes -// Other libraries and framework includes #include "llvm/ADT/APInt.h" +#include "llvm/ADT/StringRef.h" // for StringRef -// Project includes -#include "lldb/Core/Scalar.h" -#include "lldb/Host/Endian.h" -#include "lldb/lldb-private.h" -#include "lldb/lldb-public.h" +#include <stdint.h> // for uint32_t, uint8_t, uint64_t, uin... +#include <string.h> namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +struct RegisterInfo; +} +namespace lldb_private { class RegisterValue { public: diff --git a/include/lldb/Core/Scalar.h b/include/lldb/Core/Scalar.h index cee257711c5f..c534044af753 100644 --- a/include/lldb/Core/Scalar.h +++ b/include/lldb/Core/Scalar.h @@ -10,10 +10,23 @@ #ifndef liblldb_Scalar_h_ #define liblldb_Scalar_h_ -#include "lldb/lldb-private.h" +#include "lldb/Utility/Error.h" // for Error +#include "lldb/lldb-enumerations.h" // for Encoding, ByteOrder +#include "lldb/lldb-private-types.h" // for type128 + #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int64_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Stream; +} + #define NUM_OF_WORDS_INT128 2 #define BITWIDTH_INT128 128 #define NUM_OF_WORDS_INT256 4 diff --git a/include/lldb/Core/SearchFilter.h b/include/lldb/Core/SearchFilter.h index 6b3a79e99520..829305ff5dee 100644 --- a/include/lldb/Core/SearchFilter.h +++ b/include/lldb/Core/SearchFilter.h @@ -10,13 +10,44 @@ #ifndef liblldb_SearchFilter_h_ #define liblldb_SearchFilter_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/FileSpecList.h" #include "lldb/Core/StructuredData.h" -#include "lldb/lldb-private.h" + +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-forward.h" // for SearchFilterSP, TargetSP, Modu... + +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Breakpoint; +} +namespace lldb_private { +class CompileUnit; +} +namespace lldb_private { +class Error; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class ModuleList; +} +namespace lldb_private { +class SearchFilter; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class Target; +} namespace lldb_private { diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h index 5afaa11359db..a133298edaf3 100644 --- a/include/lldb/Core/Section.h +++ b/include/lldb/Core/Section.h @@ -10,16 +10,39 @@ #ifndef liblldb_Section_h_ #define liblldb_Section_h_ -#include "lldb/Core/AddressRange.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Flags.h" #include "lldb/Core/ModuleChild.h" -#include "lldb/Core/RangeMap.h" -#include "lldb/Core/UserID.h" -#include "lldb/Core/VMRange.h" -#include "lldb/Symbol/ObjectFile.h" -#include "lldb/lldb-private.h" -#include <limits.h> +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Flags.h" +#include "lldb/Utility/UserID.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for SectionType +#include "lldb/lldb-forward.h" // for SectionSP, ModuleSP, SectionWP +#include "lldb/lldb-types.h" // for addr_t, offset_t, user_id_t + +#include <memory> // for enable_shared_from_this +#include <vector> // for vector + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, UINT32_MAX + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class ObjectFile; +} +namespace lldb_private { +class Section; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Target; +} namespace lldb_private { diff --git a/include/lldb/Core/SourceManager.h b/include/lldb/Core/SourceManager.h index 9ca2a3297230..053badf64ddc 100644 --- a/include/lldb/Core/SourceManager.h +++ b/include/lldb/Core/SourceManager.h @@ -10,20 +10,33 @@ #ifndef liblldb_SourceManager_h_ #define liblldb_SourceManager_h_ -// Project includes -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for DebuggerSP, DebuggerWP, DataBufferSP -// Other libraries and framework includes #include "llvm/Support/Chrono.h" -// C Includes -// C++ Includes +#include <cstdint> // for uint32_t, UINT32_MAX #include <map> #include <memory> +#include <stddef.h> // for size_t +#include <string> // for string #include <vector> namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class Target; +} + +namespace lldb_private { class SourceManager { public: diff --git a/include/lldb/Core/State.h b/include/lldb/Core/State.h index a9d7692ca458..68f0fee254b3 100644 --- a/include/lldb/Core/State.h +++ b/include/lldb/Core/State.h @@ -10,11 +10,13 @@ #ifndef liblldb_State_h_ #define liblldb_State_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" +#include "llvm/Support/FormatProviders.h" + +#include "lldb/lldb-enumerations.h" // for StateType +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/raw_ostream.h" // for raw_ostream + +#include <stdint.h> // for uint32_t namespace lldb_private { @@ -71,4 +73,13 @@ const char *GetPermissionsAsCString(uint32_t permissions); } // namespace lldb_private +namespace llvm { +template <> struct format_provider<lldb::StateType> { + static void format(const lldb::StateType &state, raw_ostream &Stream, + StringRef Style) { + Stream << lldb_private::StateAsCString(state); + } +}; +} + #endif // liblldb_State_h_ diff --git a/include/lldb/Core/StreamAsynchronousIO.h b/include/lldb/Core/StreamAsynchronousIO.h index b3bb49e16e35..29b109757da7 100644 --- a/include/lldb/Core/StreamAsynchronousIO.h +++ b/include/lldb/Core/StreamAsynchronousIO.h @@ -1,5 +1,4 @@ -//===-- StreamAsynchronousIO.h -----------------------------------*- C++ -//-*-===// +//===-- StreamAsynchronousIO.h -----------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,9 +10,15 @@ #ifndef liblldb_StreamAsynchronousIO_h_ #define liblldb_StreamAsynchronousIO_h_ +#include "lldb/Utility/Stream.h" + #include <string> -#include "lldb/Core/Stream.h" +#include <stddef.h> // for size_t + +namespace lldb_private { +class Debugger; +} namespace lldb_private { diff --git a/include/lldb/Core/StreamBuffer.h b/include/lldb/Core/StreamBuffer.h index 4eef19ff29f7..3b18573021b3 100644 --- a/include/lldb/Core/StreamBuffer.h +++ b/include/lldb/Core/StreamBuffer.h @@ -10,7 +10,7 @@ #ifndef liblldb_StreamBuffer_h_ #define liblldb_StreamBuffer_h_ -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" #include "llvm/ADT/SmallVector.h" #include <stdio.h> #include <string> diff --git a/include/lldb/Core/StreamFile.h b/include/lldb/Core/StreamFile.h index 8b860321b6b7..a26ae84c7be5 100644 --- a/include/lldb/Core/StreamFile.h +++ b/include/lldb/Core/StreamFile.h @@ -10,16 +10,13 @@ #ifndef liblldb_StreamFile_h_ #define liblldb_StreamFile_h_ -// C Includes -// C++ Includes - -#include <string> - -// Other libraries and framework includes -// Project includes - -#include "lldb/Core/Stream.h" #include "lldb/Host/File.h" +#include "lldb/Utility/Stream.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermission... + +#include <stdint.h> // for uint32_t +#include <stdio.h> // for size_t, FILE namespace lldb_private { diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h index efd8100f1185..eecfd86f7988 100644 --- a/include/lldb/Core/StructuredData.h +++ b/include/lldb/Core/StructuredData.h @@ -10,22 +10,29 @@ #ifndef liblldb_StructuredData_h_ #define liblldb_StructuredData_h_ -// C Includes -// C++ Includes +#include "llvm/ADT/StringRef.h" + +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/FileSpec.h" // for FileSpec + #include <functional> #include <map> #include <memory> #include <string> +#include <type_traits> // for move #include <utility> #include <vector> -// Other libraries and framework includes -#include "llvm/ADT/StringRef.h" +#include <assert.h> // for assert +#include <stddef.h> // for size_t +#include <stdint.h> // for uint64_t -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" -#include "lldb/lldb-defines.h" +namespace lldb_private { +class Error; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { @@ -368,13 +375,12 @@ public: } ObjectSP GetKeys() const { - ObjectSP object_sp(new Array()); - Array *array = object_sp->GetAsArray(); + auto object_sp = std::make_shared<Array>(); collection::const_iterator iter; for (iter = m_dict.begin(); iter != m_dict.end(); ++iter) { - ObjectSP key_object_sp(new String()); - key_object_sp->GetAsString()->SetValue(iter->first.AsCString()); - array->Push(key_object_sp); + auto key_object_sp = std::make_shared<String>(); + key_object_sp->SetValue(iter->first.AsCString()); + object_sp->Push(key_object_sp); } return object_sp; } @@ -500,19 +506,19 @@ public: } void AddIntegerItem(llvm::StringRef key, uint64_t value) { - AddItem(key, ObjectSP(new Integer(value))); + AddItem(key, std::make_shared<Integer>(value)); } void AddFloatItem(llvm::StringRef key, double value) { - AddItem(key, ObjectSP(new Float(value))); + AddItem(key, std::make_shared<Float>(value)); } void AddStringItem(llvm::StringRef key, std::string value) { - AddItem(key, ObjectSP(new String(std::move(value)))); + AddItem(key, std::make_shared<String>(std::move(value))); } void AddBooleanItem(llvm::StringRef key, bool value) { - AddItem(key, ObjectSP(new Boolean(value))); + AddItem(key, std::make_shared<Boolean>(value)); } void Dump(Stream &s, bool pretty_print = true) const override; diff --git a/include/lldb/Core/Timer.h b/include/lldb/Core/Timer.h index 854d3c31f54f..6da00b0e27a4 100644 --- a/include/lldb/Core/Timer.h +++ b/include/lldb/Core/Timer.h @@ -10,18 +10,16 @@ #ifndef liblldb_Timer_h_ #define liblldb_Timer_h_ -// C Includes -#include <stdarg.h> -#include <stdio.h> +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "llvm/Support/Chrono.h" -// C++ Includes #include <atomic> -#include <mutex> -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" -#include "llvm/Support/Chrono.h" +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Core/UniqueCStringMap.h b/include/lldb/Core/UniqueCStringMap.h index 77a350aaea15..1475fdaa74d9 100644 --- a/include/lldb/Core/UniqueCStringMap.h +++ b/include/lldb/Core/UniqueCStringMap.h @@ -17,7 +17,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/RegularExpression.h" +#include "lldb/Utility/RegularExpression.h" + +#include "llvm/ADT/StringRef.h" namespace lldb_private { diff --git a/include/lldb/Core/UserSettingsController.h b/include/lldb/Core/UserSettingsController.h index a30dfd45121b..0207187f0718 100644 --- a/include/lldb/Core/UserSettingsController.h +++ b/include/lldb/Core/UserSettingsController.h @@ -10,21 +10,32 @@ #ifndef liblldb_UserSettingsController_h_ #define liblldb_UserSettingsController_h_ -// C Includes -// C++ Includes +#include "lldb/Utility/Error.h" // for Error +#include "lldb/lldb-forward.h" // for OptionValuePropertiesSP +#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType + +#include "llvm/ADT/StringRef.h" // for StringRef -#include <string> #include <vector> -// Other libraries and framework includes -// Project includes +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/StringList.h" -#include "lldb/Interpreter/OptionValue.h" -#include "lldb/lldb-private.h" +namespace lldb_private { +class CommandInterpreter; +} +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class ExecutionContext; +} +namespace lldb_private { +class Property; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Core/Value.h b/include/lldb/Core/Value.h index 2800c4f20996..9a667cf65752 100644 --- a/include/lldb/Core/Value.h +++ b/include/lldb/Core/Value.h @@ -10,17 +10,39 @@ #ifndef liblldb_Value_h_ #define liblldb_Value_h_ -// C Includes -// C++ Includes -#include <vector> - -// Other libraries and framework includes -// Project includes -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Scalar.h" #include "lldb/Symbol/CompilerType.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/Error.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder, ByteOrder::eB... +#include "lldb/lldb-private-enumerations.h" // for AddressType +#include "lldb/lldb-private-types.h" // for type128, RegisterInfo + +#include "llvm/ADT/APInt.h" // for APInt + +#include <vector> + +#include <stdint.h> // for uint8_t, uint32_t, uint64_t +#include <string.h> // for size_t, memcpy + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class ExecutionContext; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Type; +} +namespace lldb_private { +class Variable; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h index 84b187e54b6c..1c923f317b7c 100644 --- a/include/lldb/Core/ValueObject.h +++ b/include/lldb/Core/ValueObject.h @@ -10,32 +10,67 @@ #ifndef liblldb_ValueObject_h_ #define liblldb_ValueObject_h_ -// C Includes -// C++ Includes -#include <functional> -#include <initializer_list> -#include <map> -#include <vector> - -// Other libraries and framework includes -#include "llvm/ADT/Optional.h" -#include "llvm/ADT/SmallVector.h" - -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Flags.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/Value.h" +#include "lldb/DataFormatters/DumpValueObjectOptions.h" // for DumpValueObj... #include "lldb/Symbol/CompilerType.h" +#include "lldb/Symbol/Type.h" // for TypeImpl #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/Process.h" -#include "lldb/Target/StackID.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Error.h" #include "lldb/Utility/SharedCluster.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/UserID.h" +#include "lldb/lldb-defines.h" // for LLDB_INVALID... +#include "lldb/lldb-enumerations.h" // for DynamicValue... +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-private-enumerations.h" // for AddressType +#include "lldb/lldb-types.h" // for addr_t, offs... + +#include "llvm/ADT/Optional.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" // for StringRef +#include <functional> +#include <initializer_list> +#include <map> +#include <mutex> // for recursive_mutex +#include <string> // for string +#include <utility> // for pair +#include <vector> + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t +namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class EvaluateExpressionOptions; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Scalar; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContextScope; +} +namespace lldb_private { +class TypeFormatImpl; +} +namespace lldb_private { +class TypeSummaryImpl; +} +namespace lldb_private { +class TypeSummaryOptions; +} namespace lldb_private { /// ValueObject: @@ -552,6 +587,9 @@ public: lldb::ValueObjectSP GetSP() { return m_manager->GetSharedPointer(this); } + // Change the name of the current ValueObject. Should *not* be used from a + // synthetic child provider as it would change the name of the non synthetic + // child as well. void SetName(const ConstString &name); virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, @@ -600,6 +638,12 @@ public: virtual lldb::ValueObjectSP Dereference(Error &error); + // Creates a copy of the ValueObject with a new name and setting the current + // ValueObject as its parent. It should be used when we want to change the + // name of a ValueObject without modifying the actual ValueObject itself + // (e.g. sythetic child provider). + virtual lldb::ValueObjectSP Clone(const ConstString &new_name); + virtual lldb::ValueObjectSP AddressOf(Error &error); virtual lldb::addr_t GetLiveAddress() { return LLDB_INVALID_ADDRESS; } diff --git a/include/lldb/Core/ValueObjectCast.h b/include/lldb/Core/ValueObjectCast.h index 50959b927e70..aaa1ecb67db8 100644 --- a/include/lldb/Core/ValueObjectCast.h +++ b/include/lldb/Core/ValueObjectCast.h @@ -10,11 +10,18 @@ #ifndef liblldb_ValueObjectCast_h_ #define liblldb_ValueObjectCast_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-forward.h" // for ValueObjectSP + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class ConstString; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h index b84cb3dfa216..ec8c9e805cdf 100644 --- a/include/lldb/Core/ValueObjectChild.h +++ b/include/lldb/Core/ValueObjectChild.h @@ -10,14 +10,20 @@ #ifndef liblldb_ValueObjectChild_h_ #define liblldb_ValueObjectChild_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-private-enumerations.h" // for LazyBool, AddressType +#include "lldb/lldb-types.h" // for offset_t + #include "llvm/ADT/Optional.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int32_t + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h index 994ac477bf2e..403d19324c46 100644 --- a/include/lldb/Core/ValueObjectConstResult.h +++ b/include/lldb/Core/ValueObjectConstResult.h @@ -10,15 +10,31 @@ #ifndef liblldb_ValueObjectConstResult_h_ #define liblldb_ValueObjectConstResult_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/Core/Value.h" // for Value #include "lldb/Core/ValueObject.h" - #include "lldb/Core/ValueObjectConstResultImpl.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/Error.h" // for Error +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-enumerations.h" // for ByteOrder, Dynamic... +#include "lldb/lldb-forward.h" // for ValueObjectSP, Dat... +#include "lldb/lldb-private-enumerations.h" // for AddressType, Addre... +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { //---------------------------------------------------------------------- // A frozen ValueObject copied into host memory diff --git a/include/lldb/Core/ValueObjectConstResultCast.h b/include/lldb/Core/ValueObjectConstResultCast.h index 4b2a3e2fb9b0..3443bfb4885b 100644 --- a/include/lldb/Core/ValueObjectConstResultCast.h +++ b/include/lldb/Core/ValueObjectConstResultCast.h @@ -10,12 +10,26 @@ #ifndef liblldb_ValueObjectConstResultCast_h_ #define liblldb_ValueObjectConstResultCast_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObjectCast.h" #include "lldb/Core/ValueObjectConstResultImpl.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_... +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int32_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Error; +} +namespace lldb_private { +class ValueObject; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectConstResultChild.h b/include/lldb/Core/ValueObjectConstResultChild.h index 66127b94b422..3da59dc2eb56 100644 --- a/include/lldb/Core/ValueObjectConstResultChild.h +++ b/include/lldb/Core/ValueObjectConstResultChild.h @@ -1,5 +1,4 @@ -//===-- ValueObjectConstResultChild.h -------------------------------*- C++ -//-*-===// +//===-- ValueObjectConstResultChild.h ----------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,12 +10,25 @@ #ifndef liblldb_ValueObjectConstResultChild_h_ #define liblldb_ValueObjectConstResultChild_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObjectChild.h" #include "lldb/Core/ValueObjectConstResultImpl.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_... +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int32_t +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Error; +} +namespace lldb_private { +class ValueObject; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectConstResultImpl.h b/include/lldb/Core/ValueObjectConstResultImpl.h index c26bf419b18e..2586aab4c781 100644 --- a/include/lldb/Core/ValueObjectConstResultImpl.h +++ b/include/lldb/Core/ValueObjectConstResultImpl.h @@ -10,11 +10,26 @@ #ifndef liblldb_ValueObjectConstResultImpl_h_ #define liblldb_ValueObjectConstResultImpl_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ValueObject.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-private-enumerations.h" // for AddressType, AddressType... +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int32_t +namespace lldb_private { +class CompilerType; +} +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Error; +} +namespace lldb_private { +class ValueObject; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h index e58e74f534aa..99eb1ebcf977 100644 --- a/include/lldb/Core/ValueObjectDynamicValue.h +++ b/include/lldb/Core/ValueObjectDynamicValue.h @@ -10,13 +10,30 @@ #ifndef liblldb_ValueObjectDynamicValue_h_ #define liblldb_ValueObjectDynamicValue_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType #include "lldb/Symbol/Type.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/SharingPtr.h" // for operator== +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for DynamicValueType, Langua... +#include "lldb/lldb-forward.h" // for ValueObjectSP, VariableSP +#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz... +#include <assert.h> // for assert +#include <stddef.h> // for size_t +#include <stdint.h> // for uint64_t, uint32_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class Error; +} namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Core/ValueObjectList.h b/include/lldb/Core/ValueObjectList.h index c5427c6a846e..a0d2e681dedb 100644 --- a/include/lldb/Core/ValueObjectList.h +++ b/include/lldb/Core/ValueObjectList.h @@ -10,15 +10,16 @@ #ifndef liblldb_ValueObjectList_h_ #define liblldb_ValueObjectList_h_ -// C Includes -// C++ Includes +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-types.h" // for user_id_t + #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/UserID.h" -#include "lldb/Target/ExecutionContextScope.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t + +namespace lldb_private { +class ValueObject; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectMemory.h b/include/lldb/Core/ValueObjectMemory.h index f9891c41cec6..8bb649cc3c52 100644 --- a/include/lldb/Core/ValueObjectMemory.h +++ b/include/lldb/Core/ValueObjectMemory.h @@ -10,12 +10,21 @@ #ifndef liblldb_ValueObjectMemory_h_ #define liblldb_ValueObjectMemory_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-forward.h" // for TypeSP, ValueObjectSP, ModuleSP +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class ExecutionContextScope; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectRegister.h b/include/lldb/Core/ValueObjectRegister.h index 11d205430af8..50d0e12bb3f4 100644 --- a/include/lldb/Core/ValueObjectRegister.h +++ b/include/lldb/Core/ValueObjectRegister.h @@ -10,13 +10,33 @@ #ifndef liblldb_ValueObjectRegister_h_ #define liblldb_ValueObjectRegister_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/RegisterValue.h" #include "lldb/Core/ValueObject.h" -#include "lldb/lldb-private.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType, ValueType::eValueTy... +#include "lldb/lldb-forward.h" // for RegisterContextSP, ValueObjectSP +#include "lldb/lldb-private-types.h" // for RegisterInfo, RegisterSet (ptr... + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int32_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Error; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Scalar; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h index 0a5a4d9f7029..d83f038744e5 100644 --- a/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -10,17 +10,31 @@ #ifndef liblldb_ValueObjectSyntheticFilter_h_ #define liblldb_ValueObjectSyntheticFilter_h_ -// C Includes -// C++ Includes -#include <memory> - -// Other libraries and framework includes -// Project includes #include "lldb/Core/ThreadSafeSTLMap.h" #include "lldb/Core/ThreadSafeSTLVector.h" #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for ThreadSafeSTLMap::operator= +#include "lldb/lldb-enumerations.h" // for DynamicValueType, Langua... +#include "lldb/lldb-forward.h" // for ValueObjectSP, Synthetic... +#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz... + +#include <cstdint> // for uint32_t, uint64_t +#include <memory> + +#include <stddef.h> // for size_t namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class Error; +} +namespace lldb_private { +class SyntheticChildrenFrontEnd; +} +namespace lldb_private { //---------------------------------------------------------------------- // A ValueObject that obtains its children from some source other than diff --git a/include/lldb/Core/ValueObjectVariable.h b/include/lldb/Core/ValueObjectVariable.h index b76c48a24cd9..dbb7c2b9483e 100644 --- a/include/lldb/Core/ValueObjectVariable.h +++ b/include/lldb/Core/ValueObjectVariable.h @@ -10,12 +10,34 @@ #ifndef liblldb_ValueObjectVariable_h_ #define liblldb_ValueObjectVariable_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" +#include "lldb/Core/Value.h" // for Value +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-forward.h" // for VariableSP, ModuleSP, ValueObj... + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class Error; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class SymbolContextScope; +} + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/DataFormatters/DataVisualization.h b/include/lldb/DataFormatters/DataVisualization.h index 7a632d64c8e9..343099bf2a7b 100644 --- a/include/lldb/DataFormatters/DataVisualization.h +++ b/include/lldb/DataFormatters/DataVisualization.h @@ -15,9 +15,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/DataFormatters/FormatClasses.h" #include "lldb/DataFormatters/FormatManager.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/DataFormatters/DumpValueObjectOptions.h b/include/lldb/DataFormatters/DumpValueObjectOptions.h index b510a3c50311..00baea77f793 100644 --- a/include/lldb/DataFormatters/DumpValueObjectOptions.h +++ b/include/lldb/DataFormatters/DumpValueObjectOptions.h @@ -27,7 +27,7 @@ namespace lldb_private { class DumpValueObjectOptions { public: struct PointerDepth { - enum class Mode { Always, Formatters, Default, Never } m_mode; + enum class Mode { Always, Default, Never } m_mode; uint32_t m_count; PointerDepth operator--() const { @@ -37,9 +37,6 @@ public: } bool CanAllowExpansion() const; - - bool CanAllowExpansion(bool is_root, TypeSummaryImpl *entry, - ValueObject *valobj, const std::string &summary); }; struct PointerAsArraySettings { diff --git a/include/lldb/DataFormatters/FormatCache.h b/include/lldb/DataFormatters/FormatCache.h index ab369a1f0453..9901ec91ebd2 100644 --- a/include/lldb/DataFormatters/FormatCache.h +++ b/include/lldb/DataFormatters/FormatCache.h @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/include/lldb/DataFormatters/FormattersContainer.h b/include/lldb/DataFormatters/FormattersContainer.h index e43209969dd0..2df5bf4efcfb 100644 --- a/include/lldb/DataFormatters/FormattersContainer.h +++ b/include/lldb/DataFormatters/FormattersContainer.h @@ -22,7 +22,6 @@ // Project includes #include "lldb/lldb-public.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/FormatClasses.h" #include "lldb/DataFormatters/TypeFormat.h" @@ -30,6 +29,7 @@ #include "lldb/DataFormatters/TypeSynthetic.h" #include "lldb/DataFormatters/TypeValidator.h" #include "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/StringLexer.h" namespace lldb_private { diff --git a/include/lldb/DataFormatters/StringPrinter.h b/include/lldb/DataFormatters/StringPrinter.h index 43329466a9a4..8d4a099fbec9 100644 --- a/include/lldb/DataFormatters/StringPrinter.h +++ b/include/lldb/DataFormatters/StringPrinter.h @@ -19,7 +19,7 @@ // Project includes #include "lldb/lldb-forward.h" -#include "lldb/Core/DataExtractor.h" +#include "lldb/Utility/DataExtractor.h" namespace lldb_private { namespace formatters { diff --git a/include/lldb/DataFormatters/TypeSummary.h b/include/lldb/DataFormatters/TypeSummary.h index 7b2feeb8fc22..fbfc25dd9c9f 100644 --- a/include/lldb/DataFormatters/TypeSummary.h +++ b/include/lldb/DataFormatters/TypeSummary.h @@ -23,9 +23,9 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" -#include "lldb/Core/Error.h" #include "lldb/Core/FormatEntity.h" #include "lldb/Core/StructuredData.h" +#include "lldb/Utility/Error.h" namespace lldb_private { class TypeSummaryOptions { diff --git a/include/lldb/DataFormatters/ValueObjectPrinter.h b/include/lldb/DataFormatters/ValueObjectPrinter.h index f0d09ac01632..41851436873d 100644 --- a/include/lldb/DataFormatters/ValueObjectPrinter.h +++ b/include/lldb/DataFormatters/ValueObjectPrinter.h @@ -19,7 +19,8 @@ #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/DataFormatters/DumpValueObjectOptions.h" #include "lldb/Symbol/CompilerType.h" diff --git a/include/lldb/DataFormatters/VectorIterator.h b/include/lldb/DataFormatters/VectorIterator.h index 38bcfe9fe4a8..fcf5aba6ecbe 100644 --- a/include/lldb/DataFormatters/VectorIterator.h +++ b/include/lldb/DataFormatters/VectorIterator.h @@ -13,8 +13,8 @@ #include "lldb/lldb-forward.h" -#include "lldb/Core/ConstString.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { namespace formatters { diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h index ea3f5cc03db1..ae9eb3fb2d16 100644 --- a/include/lldb/Expression/DWARFExpression.h +++ b/include/lldb/Expression/DWARFExpression.h @@ -11,10 +11,10 @@ #define liblldb_DWARFExpression_h_ #include "lldb/Core/Address.h" -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/Disassembler.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Scalar.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private.h" #include <functional> diff --git a/include/lldb/Expression/ExpressionParser.h b/include/lldb/Expression/ExpressionParser.h index 99f583d7ca92..9f33908b8f1b 100644 --- a/include/lldb/Expression/ExpressionParser.h +++ b/include/lldb/Expression/ExpressionParser.h @@ -10,7 +10,7 @@ #ifndef liblldb_ExpressionParser_h_ #define liblldb_ExpressionParser_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/include/lldb/Expression/ExpressionVariable.h b/include/lldb/Expression/ExpressionVariable.h index 3f6b020139de..c7570932c15a 100644 --- a/include/lldb/Expression/ExpressionVariable.h +++ b/include/lldb/Expression/ExpressionVariable.h @@ -19,8 +19,8 @@ #include "llvm/ADT/DenseMap.h" // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Core/ValueObject.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h index 72c1775b550d..635e0b727d5c 100644 --- a/include/lldb/Expression/IRExecutionUnit.h +++ b/include/lldb/Expression/IRExecutionUnit.h @@ -22,10 +22,10 @@ #include "llvm/IR/Module.h" // Project includes -#include "lldb/Core/DataBufferHeap.h" #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Utility/DataBufferHeap.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Expression/IRInterpreter.h b/include/lldb/Expression/IRInterpreter.h index b821e6750b2d..f9392c18c25c 100644 --- a/include/lldb/Expression/IRInterpreter.h +++ b/include/lldb/Expression/IRInterpreter.h @@ -10,8 +10,8 @@ #ifndef liblldb_IRInterpreter_h_ #define liblldb_IRInterpreter_h_ -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Stream.h" #include "lldb/lldb-public.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/Pass.h" diff --git a/include/lldb/Expression/IRMemoryMap.h b/include/lldb/Expression/IRMemoryMap.h index 405de51bfc45..c1a194d1afad 100644 --- a/include/lldb/Expression/IRMemoryMap.h +++ b/include/lldb/Expression/IRMemoryMap.h @@ -10,8 +10,8 @@ #ifndef lldb_IRMemoryMap_h_ #define lldb_IRMemoryMap_h_ -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/UserID.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-public.h" #include <map> diff --git a/include/lldb/Expression/Materializer.h b/include/lldb/Expression/Materializer.h index 4874929136fd..ed3f91cc67ec 100644 --- a/include/lldb/Expression/Materializer.h +++ b/include/lldb/Expression/Materializer.h @@ -17,10 +17,10 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/StackFrame.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private-types.h" namespace lldb_private { diff --git a/include/lldb/Host/Config.h b/include/lldb/Host/Config.h index 16845ae9327b..95d0191397b3 100644 --- a/include/lldb/Host/Config.h +++ b/include/lldb/Host/Config.h @@ -7,42 +7,21 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Config_h_ -#define liblldb_Config_h_ - +#ifndef LLDB_HOST_CONFIG_H +#define LLDB_HOST_CONFIG_H + #if defined(__APPLE__) -#include "lldb/Host/macosx/Config.h" - -#elif defined(__ANDROID__) - -#include "lldb/Host/android/Config.h" - -#elif defined(__linux__) || defined(__GNU__) - -#include "lldb/Host/linux/Config.h" - -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__OpenBSD__) - -#include "lldb/Host/freebsd/Config.h" - -#elif defined(__NetBSD__) - -#include "lldb/Host/netbsd/Config.h" - -#elif defined(__MINGW__) || defined(__MINGW32__) - -#include "lldb/Host/mingw/Config.h" - -#elif defined(_MSC_VER) +// This block of code only exists to keep the Xcode project working in the +// absence of a configuration step. +#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 -#include "lldb/Host/msvc/Config.h" +#define HAVE_SYS_EVENT_H 1 #else -#error undefined platform +#error This file is only used by the Xcode build. #endif -#endif // #ifndef liblldb_Config_h_ +#endif // #ifndef LLDB_HOST_CONFIG_H diff --git a/include/lldb/Host/Config.h.cmake b/include/lldb/Host/Config.h.cmake new file mode 100644 index 000000000000..d072c1a08687 --- /dev/null +++ b/include/lldb/Host/Config.h.cmake @@ -0,0 +1,19 @@ +//===-- Config.h -----------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_HOST_CONFIG_H +#define LLDB_HOST_CONFIG_H + +#cmakedefine LLDB_CONFIG_TERMIOS_SUPPORTED + +#cmakedefine LLDB_DISABLE_POSIX + +#cmakedefine01 HAVE_SYS_EVENT_H + +#endif // #ifndef LLDB_HOST_CONFIG_H diff --git a/include/lldb/Host/Editline.h b/include/lldb/Host/Editline.h index faed373bc218..2b1a8e047261 100644 --- a/include/lldb/Host/Editline.h +++ b/include/lldb/Host/Editline.h @@ -43,7 +43,8 @@ // will only be // used in cases where this is true. This is a compile time dependecy, for now // selected per target Platform -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ + defined(__OpenBSD__) #define LLDB_EDITLINE_USE_WCHAR 1 #include <codecvt> #else @@ -64,8 +65,8 @@ #include <vector> #include "lldb/Host/ConnectionFileDescriptor.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Host/Predicate.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { namespace line_editor { diff --git a/include/lldb/Host/File.h b/include/lldb/Host/File.h index 6fa4e568218f..35317780f1ce 100644 --- a/include/lldb/Host/File.h +++ b/include/lldb/Host/File.h @@ -10,18 +10,15 @@ #ifndef liblldb_File_h_ #define liblldb_File_h_ -// C Includes -// C++ Includes -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> - -// Other libraries and framework includes -// Project includes #include "lldb/Host/IOObject.h" #include "lldb/Host/PosixApi.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private.h" +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Host/FileCache.h b/include/lldb/Host/FileCache.h index 1667d05e2a52..094ee695ce32 100644 --- a/include/lldb/Host/FileCache.h +++ b/include/lldb/Host/FileCache.h @@ -9,13 +9,14 @@ #ifndef liblldb_Host_FileCache_h #define liblldb_Host_FileCache_h +#include <map> #include <stdint.h> #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" -#include "lldb/Core/Error.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { class FileCache { diff --git a/include/lldb/Host/FileSystem.h b/include/lldb/Host/FileSystem.h index 6dbea6d2cce3..794308ff4244 100644 --- a/include/lldb/Host/FileSystem.h +++ b/include/lldb/Host/FileSystem.h @@ -10,8 +10,8 @@ #ifndef liblldb_Host_FileSystem_h #define liblldb_Host_FileSystem_h -#include "lldb/Core/Error.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/FileSpec.h" #include "llvm/Support/Chrono.h" #include "lldb/lldb-types.h" @@ -26,47 +26,15 @@ public: static const char *DEV_NULL; static const char *PATH_CONVERSION_ERROR; - static FileSpec::PathSyntax GetNativePathSyntax(); - - static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode); - static Error DeleteDirectory(const FileSpec &file_spec, bool recurse); - - static Error GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions); - static Error SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions); - static lldb::user_id_t GetFileSize(const FileSpec &file_spec); - static bool GetFileExists(const FileSpec &file_spec); - - static Error Hardlink(const FileSpec &src, const FileSpec &dst); - static int GetHardlinkCount(const FileSpec &file_spec); static Error Symlink(const FileSpec &src, const FileSpec &dst); static Error Readlink(const FileSpec &src, FileSpec &dst); - static Error Unlink(const FileSpec &file_spec); static Error ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); - static bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, - uint64_t &high); - static bool CalculateMD5(const FileSpec &file_spec, uint64_t offset, - uint64_t length, uint64_t &low, uint64_t &high); - - static bool CalculateMD5AsString(const FileSpec &file_spec, - std::string &digest_str); - static bool CalculateMD5AsString(const FileSpec &file_spec, uint64_t offset, - uint64_t length, std::string &digest_str); - - /// Return \b true if \a spec is on a locally mounted file system, \b false - /// otherwise. - static bool IsLocal(const FileSpec &spec); - /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be /// manipulated and closed with the normal ::fread, ::fclose, etc. functions. static FILE *Fopen(const char *path, const char *mode); - /// Wraps ::stat in a platform-independent way. - static int Stat(const char *path, struct stat *stats); - static llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec); }; } diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h index 64c0dd6cef6b..8415d429d5e2 100644 --- a/include/lldb/Host/Host.h +++ b/include/lldb/Host/Host.h @@ -16,10 +16,10 @@ #include <map> #include <string> -#include "lldb/Core/StringList.h" #include "lldb/Host/File.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Host/HostThread.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-private.h" @@ -100,14 +100,6 @@ public: static void Kill(lldb::pid_t pid, int signo); //------------------------------------------------------------------ - /// Get the thread ID for the calling thread in the current process. - /// - /// @return - /// The thread ID for the calling thread in the current process. - //------------------------------------------------------------------ - static lldb::tid_t GetCurrentThreadID(); - - //------------------------------------------------------------------ /// Get the thread token (the one returned by ThreadCreate when the thread was /// created) for the /// calling thread in the current process. @@ -193,7 +185,7 @@ public: static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info); #if (defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || \ - defined(__GLIBC__) || defined(__NetBSD__)) && \ + defined(__GLIBC__) || defined(__NetBSD__) || defined(__OpenBSD__)) && \ !defined(__ANDROID__) static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info); @@ -246,10 +238,6 @@ public: uint32_t timeout_sec, bool run_in_default_shell = true); - static lldb::DataBufferSP GetAuxvData(lldb_private::Process *process); - - static lldb::DataBufferSP GetAuxvData(lldb::pid_t pid); - static bool OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t line_no); diff --git a/include/lldb/Host/HostInfo.h b/include/lldb/Host/HostInfo.h index 4646be2b9234..b4a2f8baf37f 100644 --- a/include/lldb/Host/HostInfo.h +++ b/include/lldb/Host/HostInfo.h @@ -51,6 +51,9 @@ #elif defined(__NetBSD__) #include "lldb/Host/netbsd/HostInfoNetBSD.h" #define HOST_INFO_TYPE HostInfoNetBSD +#elif defined(__OpenBSD__) +#include "lldb/Host/openbsd/HostInfoOpenBSD.h" +#define HOST_INFO_TYPE HostInfoOpenBSD #elif defined(__APPLE__) #include "lldb/Host/macosx/HostInfoMacOSX.h" #define HOST_INFO_TYPE HostInfoMacOSX diff --git a/include/lldb/Host/HostInfoBase.h b/include/lldb/Host/HostInfoBase.h index 74ac79b690b9..42e3fc3fd1da 100644 --- a/include/lldb/Host/HostInfoBase.h +++ b/include/lldb/Host/HostInfoBase.h @@ -11,7 +11,7 @@ #define lldb_Host_HostInfoBase_h_ #include "lldb/Core/ArchSpec.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-enumerations.h" #include "llvm/ADT/StringRef.h" @@ -35,39 +35,6 @@ public: static void Terminate(); //------------------------------------------------------------------ - /// Returns the number of CPUs on this current host. - /// - /// @return - /// Number of CPUs on this current host, or zero if the number - /// of CPUs can't be determined on this host. - //------------------------------------------------------------------ - static uint32_t GetNumberCPUS(); - - //------------------------------------------------------------------ - /// Returns the maximum length of a thread name on this platform. - /// - /// @return - /// Maximum length of a thread name on this platform. - //------------------------------------------------------------------ - static uint32_t GetMaxThreadNameLength(); - - //------------------------------------------------------------------ - /// Gets the host vendor string. - /// - /// @return - /// A const string object containing the host vendor name. - //------------------------------------------------------------------ - static llvm::StringRef GetVendorString(); - - //------------------------------------------------------------------ - /// Gets the host Operating System (OS) string. - /// - /// @return - /// A const string object containing the host OS name. - //------------------------------------------------------------------ - static llvm::StringRef GetOSString(); - - //------------------------------------------------------------------ /// Gets the host target triple as a const string. /// /// @return diff --git a/include/lldb/Host/HostNativeProcessBase.h b/include/lldb/Host/HostNativeProcessBase.h index 204f78eab583..0befe867c296 100644 --- a/include/lldb/Host/HostNativeProcessBase.h +++ b/include/lldb/Host/HostNativeProcessBase.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_HostNativeProcessBase_h_ #define lldb_Host_HostNativeProcessBase_h_ -#include "lldb/Core/Error.h" #include "lldb/Host/HostProcess.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" diff --git a/include/lldb/Host/HostNativeThread.h b/include/lldb/Host/HostNativeThread.h index b0411cad7a3e..e33d978d5ae4 100644 --- a/include/lldb/Host/HostNativeThread.h +++ b/include/lldb/Host/HostNativeThread.h @@ -14,14 +14,10 @@ #if defined(_WIN32) #include "lldb/Host/windows/HostThreadWindows.h" -#elif defined(__linux__) -#include "lldb/Host/linux/HostThreadLinux.h" -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include "lldb/Host/freebsd/HostThreadFreeBSD.h" -#elif defined(__NetBSD__) -#include "lldb/Host/netbsd/HostThreadNetBSD.h" #elif defined(__APPLE__) #include "lldb/Host/macosx/HostThreadMacOSX.h" +#else +#include "lldb/Host/posix/HostThreadPosix.h" #endif #endif diff --git a/include/lldb/Host/HostNativeThreadBase.h b/include/lldb/Host/HostNativeThreadBase.h index 284b754266fb..9bf86e0759f5 100644 --- a/include/lldb/Host/HostNativeThreadBase.h +++ b/include/lldb/Host/HostNativeThreadBase.h @@ -10,7 +10,7 @@ #ifndef lldb_Host_HostNativeThreadBase_h_ #define lldb_Host_HostNativeThreadBase_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" diff --git a/include/lldb/Host/HostNativeThreadForward.h b/include/lldb/Host/HostNativeThreadForward.h index 5b832136acf5..4691a22ac844 100644 --- a/include/lldb/Host/HostNativeThreadForward.h +++ b/include/lldb/Host/HostNativeThreadForward.h @@ -14,18 +14,12 @@ namespace lldb_private { #if defined(_WIN32) class HostThreadWindows; typedef HostThreadWindows HostNativeThread; -#elif defined(__linux__) -class HostThreadLinux; -typedef HostThreadLinux HostNativeThread; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -class HostThreadFreeBSD; -typedef HostThreadFreeBSD HostNativeThread; -#elif defined(__NetBSD__) -class HostThreadNetBSD; -typedef HostThreadNetBSD HostNativeThread; #elif defined(__APPLE__) class HostThreadMacOSX; typedef HostThreadMacOSX HostNativeThread; +#else +class HostThreadPosix; +typedef HostThreadPosix HostNativeThread; #endif } diff --git a/include/lldb/Host/HostThread.h b/include/lldb/Host/HostThread.h index d14f0f6c638c..96314813cf7c 100644 --- a/include/lldb/Host/HostThread.h +++ b/include/lldb/Host/HostThread.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_HostThread_h_ #define lldb_Host_HostThread_h_ -#include "lldb/Core/Error.h" #include "lldb/Host/HostNativeThreadForward.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-types.h" #include <memory> diff --git a/include/lldb/Host/LockFileBase.h b/include/lldb/Host/LockFileBase.h index 3b2f72357bd4..74eafb279324 100644 --- a/include/lldb/Host/LockFileBase.h +++ b/include/lldb/Host/LockFileBase.h @@ -10,7 +10,7 @@ #ifndef liblldb_Host_LockFileBase_h_ #define liblldb_Host_LockFileBase_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Error.h" #include <functional> diff --git a/include/lldb/Host/MainLoopBase.h b/include/lldb/Host/MainLoopBase.h index cd29796bc9d6..b746a9cb208c 100644 --- a/include/lldb/Host/MainLoopBase.h +++ b/include/lldb/Host/MainLoopBase.h @@ -14,8 +14,8 @@ #include "llvm/Support/ErrorHandling.h" -#include "lldb/Core/Error.h" #include "lldb/Host/IOObject.h" +#include "lldb/Utility/Error.h" namespace lldb_private { diff --git a/include/lldb/Host/PipeBase.h b/include/lldb/Host/PipeBase.h index e3d7c25a9ae2..f141b5d413a0 100644 --- a/include/lldb/Host/PipeBase.h +++ b/include/lldb/Host/PipeBase.h @@ -14,7 +14,7 @@ #include <chrono> #include <string> -#include "lldb/Core/Error.h" +#include "lldb/Utility/Error.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" diff --git a/include/lldb/Utility/PseudoTerminal.h b/include/lldb/Host/PseudoTerminal.h index fbe93343452e..fdbf6df1a186 100644 --- a/include/lldb/Utility/PseudoTerminal.h +++ b/include/lldb/Host/PseudoTerminal.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_PseudoTerminal_h_ -#define liblldb_PseudoTerminal_h_ +#ifndef LLDB_HOST_PSEUDOTERMINAL_H +#define LLDB_HOST_PSEUDOTERMINAL_H #if defined(__cplusplus) #include <fcntl.h> @@ -19,7 +19,7 @@ namespace lldb_utility { //---------------------------------------------------------------------- -/// @class PseudoTerminal PseudoTerminal.h "lldb/Core/PseudoTerminal.h" +/// @class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h" /// @brief A pseudo terminal helper class. /// /// The pseudo terminal class abstracts the use of pseudo terminals on diff --git a/include/lldb/Host/Socket.h b/include/lldb/Host/Socket.h index 1ad3ca765cba..386133e96952 100644 --- a/include/lldb/Host/Socket.h +++ b/include/lldb/Host/Socket.h @@ -15,10 +15,10 @@ #include "lldb/lldb-private.h" -#include "lldb/Core/Error.h" #include "lldb/Host/IOObject.h" #include "lldb/Host/Predicate.h" #include "lldb/Host/SocketAddress.h" +#include "lldb/Utility/Error.h" #ifdef _WIN32 #include "lldb/Host/windows/windows.h" @@ -71,8 +71,7 @@ public: static Error TcpConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket); static Error UdpConnect(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&send_socket, - Socket *&recv_socket); + bool child_processes_inherit, Socket *&socket); static Error UnixDomainConnect(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket); static Error UnixDomainAccept(llvm::StringRef host_and_port, diff --git a/include/lldb/Host/SocketAddress.h b/include/lldb/Host/SocketAddress.h index 3d1ed906e1ef..bc66ad915bbe 100644 --- a/include/lldb/Host/SocketAddress.h +++ b/include/lldb/Host/SocketAddress.h @@ -32,15 +32,23 @@ typedef ADDRESS_FAMILY sa_family_t; // Other libraries and framework includes // Project includes #include <string> +#include <vector> namespace lldb_private { class SocketAddress { public: + //---------------------------------------------------------------------------- + // Static method to get all address information for a host and/or service + //---------------------------------------------------------------------------- + static std::vector<SocketAddress> GetAddressInfo(const char *hostname, + const char *servname); + //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ SocketAddress(); + SocketAddress(const struct addrinfo *addr_info); SocketAddress(const struct sockaddr &s); SocketAddress(const struct sockaddr_in &s); SocketAddress(const struct sockaddr_in6 &s); @@ -63,6 +71,9 @@ public: const SocketAddress &operator=(const struct sockaddr_storage &s); + bool operator==(const SocketAddress &rhs) const; + bool operator!=(const SocketAddress &rhs) const; + //------------------------------------------------------------------ // Clear the contents of this socket address //------------------------------------------------------------------ @@ -135,6 +146,11 @@ public: bool IsValid() const; //------------------------------------------------------------------ + // Returns true if the socket is INADDR_ANY + //------------------------------------------------------------------ + bool IsAnyAddr() const; + + //------------------------------------------------------------------ // Direct access to all of the sockaddr structures //------------------------------------------------------------------ struct sockaddr &sockaddr() { diff --git a/include/lldb/Host/Symbols.h b/include/lldb/Host/Symbols.h index 1339c064d54c..5f8632d221f7 100644 --- a/include/lldb/Host/Symbols.h +++ b/include/lldb/Host/Symbols.h @@ -16,10 +16,14 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { +class ArchSpec; +class ModuleSpec; +class UUID; + class Symbols { public: //---------------------------------------------------------------------- diff --git a/include/lldb/Host/ThisThread.h b/include/lldb/Host/ThisThread.h deleted file mode 100644 index 1392b10e1382..000000000000 --- a/include/lldb/Host/ThisThread.h +++ /dev/null @@ -1,37 +0,0 @@ -//===-- ThisThread.h --------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_ThisThread_h_ -#define lldb_Host_ThisThread_h_ - -#include "llvm/ADT/StringRef.h" - -#include <string> - -namespace llvm { -template <class T> class SmallVectorImpl; -} - -namespace lldb_private { - -class ThisThread { -private: - ThisThread(); - -public: - // ThisThread common functions. - static void SetName(llvm::StringRef name, int max_length); - - // ThisThread platform-specific functions. - static void SetName(llvm::StringRef name); - static void GetName(llvm::SmallVectorImpl<char> &name); -}; -} - -#endif diff --git a/include/lldb/Host/ThreadLauncher.h b/include/lldb/Host/ThreadLauncher.h index 0f2cb37c835a..4e388ca6bb9c 100644 --- a/include/lldb/Host/ThreadLauncher.h +++ b/include/lldb/Host/ThreadLauncher.h @@ -11,8 +11,8 @@ #ifndef lldb_Host_ThreadLauncher_h_ #define lldb_Host_ThreadLauncher_h_ -#include "lldb/Core/Error.h" #include "lldb/Host/HostThread.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-types.h" #include "llvm/ADT/StringRef.h" diff --git a/include/lldb/Host/XML.h b/include/lldb/Host/XML.h index 4113b3318dd0..04677625672c 100644 --- a/include/lldb/Host/XML.h +++ b/include/lldb/Host/XML.h @@ -24,8 +24,8 @@ #include "llvm/ADT/StringRef.h" // Project includes -#include "lldb/Core/StreamString.h" #include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StreamString.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Host/android/Config.h b/include/lldb/Host/android/Config.h deleted file mode 100644 index f16ed86cabb8..000000000000 --- a/include/lldb/Host/android/Config.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -//#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/include/lldb/Host/common/NativeBreakpointList.h b/include/lldb/Host/common/NativeBreakpointList.h index 2bb8e565f464..1d314e02b1d5 100644 --- a/include/lldb/Host/common/NativeBreakpointList.h +++ b/include/lldb/Host/common/NativeBreakpointList.h @@ -10,7 +10,7 @@ #ifndef liblldb_NativeBreakpointList_h_ #define liblldb_NativeBreakpointList_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private-forward.h" // #include "lldb/Host/NativeBreakpoint.h" @@ -19,6 +19,14 @@ #include <mutex> namespace lldb_private { + +struct HardwareBreakpoint { + lldb::addr_t m_addr; + size_t m_size; +}; + +using HardwareBreakpointMap = std::map<lldb::addr_t, HardwareBreakpoint>; + class NativeBreakpointList { public: typedef std::function<Error(lldb::addr_t addr, size_t size_hint, diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h index a0f03b0dafa3..7ad09d41eacf 100644 --- a/include/lldb/Host/common/NativeProcessProtocol.h +++ b/include/lldb/Host/common/NativeProcessProtocol.h @@ -10,14 +10,15 @@ #ifndef liblldb_NativeProcessProtocol_h_ #define liblldb_NativeProcessProtocol_h_ -#include <mutex> -#include <vector> - -#include "lldb/Core/Error.h" #include "lldb/Host/MainLoop.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-types.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/MemoryBuffer.h" +#include <vector> #include "NativeBreakpointList.h" #include "NativeWatchpointList.h" @@ -64,6 +65,12 @@ public: virtual Error Kill() = 0; + //------------------------------------------------------------------ + // Tells a process not to stop the inferior on given signals + // and just reinject them back. + //------------------------------------------------------------------ + virtual Error IgnoreSignals(llvm::ArrayRef<int> signals); + //---------------------------------------------------------------------- // Memory and memory region functions //---------------------------------------------------------------------- @@ -99,18 +106,28 @@ public: virtual Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) = 0; - virtual Error RemoveBreakpoint(lldb::addr_t addr); + virtual Error RemoveBreakpoint(lldb::addr_t addr, bool hardware = false); virtual Error EnableBreakpoint(lldb::addr_t addr); virtual Error DisableBreakpoint(lldb::addr_t addr); //---------------------------------------------------------------------- + // Hardware Breakpoint functions + //---------------------------------------------------------------------- + virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const; + + virtual Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size); + + virtual Error RemoveHardwareBreakpoint(lldb::addr_t addr); + + //---------------------------------------------------------------------- // Watchpoint functions //---------------------------------------------------------------------- virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const; - virtual uint32_t GetMaxWatchpoints() const; + virtual llvm::Optional<std::pair<uint32_t, uint32_t>> + GetHardwareDebugSupportInfo() const; virtual Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware); @@ -134,6 +151,9 @@ public: bool GetByteOrder(lldb::ByteOrder &byte_order) const; + virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + GetAuxvData() const = 0; + //---------------------------------------------------------------------- // Exit Status //---------------------------------------------------------------------- @@ -305,9 +325,14 @@ protected: std::vector<NativeDelegate *> m_delegates; NativeBreakpointList m_breakpoint_list; NativeWatchpointList m_watchpoint_list; + HardwareBreakpointMap m_hw_breakpoints_map; int m_terminal_fd; uint32_t m_stop_id; + // Set of signal numbers that LLDB directly injects back to inferior + // without stopping it. + llvm::DenseSet<int> m_signals_to_ignore; + // lldb_private::Host calls should be used to launch a process for debugging, // and // then the process should be attached to. When attaching to a process diff --git a/include/lldb/Host/common/NativeRegisterContext.h b/include/lldb/Host/common/NativeRegisterContext.h index dd583d7866a8..1d8b51c60cc4 100644 --- a/include/lldb/Host/common/NativeRegisterContext.h +++ b/include/lldb/Host/common/NativeRegisterContext.h @@ -75,6 +75,11 @@ public: virtual bool ClearHardwareBreakpoint(uint32_t hw_idx); + virtual Error ClearAllHardwareBreakpoints(); + + virtual Error GetHardwareBreakHitIndex(uint32_t &bp_index, + lldb::addr_t trap_addr); + virtual uint32_t NumSupportedHardwareWatchpoints(); virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, diff --git a/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h b/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h deleted file mode 100644 index 908989a0624e..000000000000 --- a/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h +++ /dev/null @@ -1,42 +0,0 @@ -//===-- NativeRegisterContextRegisterInfo.h ----------------------*- C++ -//-*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_NativeRegisterContextRegisterInfo_h -#define lldb_NativeRegisterContextRegisterInfo_h - -#include <memory> - -#include "NativeRegisterContext.h" -#include "Plugins/Process/Utility/RegisterInfoInterface.h" - -namespace lldb_private { -class NativeRegisterContextRegisterInfo : public NativeRegisterContext { -public: - /// - /// Construct a NativeRegisterContextRegisterInfo, taking ownership - /// of the register_info_interface pointer. - /// - NativeRegisterContextRegisterInfo( - NativeThreadProtocol &thread, uint32_t concrete_frame_idx, - RegisterInfoInterface *register_info_interface); - - uint32_t GetRegisterCount() const override; - - uint32_t GetUserRegisterCount() const override; - - const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg_index) const override; - - const RegisterInfoInterface &GetRegisterInfoInterface() const; - -private: - std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up; -}; -} -#endif diff --git a/include/lldb/Host/common/NativeThreadProtocol.h b/include/lldb/Host/common/NativeThreadProtocol.h index 450e74630e71..8f26616a2b4a 100644 --- a/include/lldb/Host/common/NativeThreadProtocol.h +++ b/include/lldb/Host/common/NativeThreadProtocol.h @@ -56,6 +56,13 @@ public: virtual Error RemoveWatchpoint(lldb::addr_t addr) = 0; + // --------------------------------------------------------------------- + // Thread-specific Hardware Breakpoint routines + // --------------------------------------------------------------------- + virtual Error SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0; + + virtual Error RemoveHardwareBreakpoint(lldb::addr_t addr) = 0; + protected: NativeProcessProtocolWP m_process_wp; lldb::tid_t m_tid; diff --git a/include/lldb/Host/common/NativeWatchpointList.h b/include/lldb/Host/common/NativeWatchpointList.h index 2424e5613332..ae3476f5f07e 100644 --- a/include/lldb/Host/common/NativeWatchpointList.h +++ b/include/lldb/Host/common/NativeWatchpointList.h @@ -10,7 +10,7 @@ #ifndef liblldb_NativeWatchpointList_h_ #define liblldb_NativeWatchpointList_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private-forward.h" #include <map> diff --git a/include/lldb/Host/common/UDPSocket.h b/include/lldb/Host/common/UDPSocket.h index 153804be2603..507c9827caf6 100644 --- a/include/lldb/Host/common/UDPSocket.h +++ b/include/lldb/Host/common/UDPSocket.h @@ -18,7 +18,7 @@ public: UDPSocket(bool child_processes_inherit, Error &error); static Error Connect(llvm::StringRef name, bool child_processes_inherit, - Socket *&send_socket, Socket *&recv_socket); + Socket *&socket); private: UDPSocket(NativeSocket socket); @@ -29,7 +29,7 @@ private: Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&socket) override; - SocketAddress m_send_sockaddr; + SocketAddress m_sockaddr; }; } diff --git a/include/lldb/Host/freebsd/Config.h b/include/lldb/Host/freebsd/Config.h deleted file mode 100644 index 1e9f55299d52..000000000000 --- a/include/lldb/Host/freebsd/Config.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/include/lldb/Host/freebsd/HostInfoFreeBSD.h b/include/lldb/Host/freebsd/HostInfoFreeBSD.h index a549f87740c0..945ec835f778 100644 --- a/include/lldb/Host/freebsd/HostInfoFreeBSD.h +++ b/include/lldb/Host/freebsd/HostInfoFreeBSD.h @@ -10,14 +10,13 @@ #ifndef lldb_Host_freebsd_HostInfoFreeBSD_h_ #define lldb_Host_freebsd_HostInfoFreeBSD_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { class HostInfoFreeBSD : public HostInfoPosix { public: - static uint32_t GetMaxThreadNameLength(); static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); static bool GetOSBuildString(std::string &s); static bool GetOSKernelDescription(std::string &s); diff --git a/include/lldb/Host/freebsd/HostThreadFreeBSD.h b/include/lldb/Host/freebsd/HostThreadFreeBSD.h deleted file mode 100644 index 2f1d6ceae255..000000000000 --- a/include/lldb/Host/freebsd/HostThreadFreeBSD.h +++ /dev/null @@ -1,29 +0,0 @@ -//===-- HostThreadFreeBSD.h -------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_freebsd_HostThreadFreeBSD_h_ -#define lldb_Host_freebsd_HostThreadFreeBSD_h_ - -#include "lldb/Host/posix/HostThreadPosix.h" - -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringRef.h" - -namespace lldb_private { - -class HostThreadFreeBSD : public HostThreadPosix { -public: - HostThreadFreeBSD(); - HostThreadFreeBSD(lldb::thread_t thread); - - static void GetName(lldb::tid_t tid, llvm::SmallVectorImpl<char> &name); -}; -} - -#endif diff --git a/include/lldb/Host/linux/Config.h b/include/lldb/Host/linux/Config.h deleted file mode 100644 index 1e9f55299d52..000000000000 --- a/include/lldb/Host/linux/Config.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/include/lldb/Host/linux/HostInfoLinux.h b/include/lldb/Host/linux/HostInfoLinux.h index 8cb97c0b4d6b..d1f2e747b117 100644 --- a/include/lldb/Host/linux/HostInfoLinux.h +++ b/include/lldb/Host/linux/HostInfoLinux.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_linux_HostInfoLinux_h_ #define lldb_Host_linux_HostInfoLinux_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" #include "llvm/ADT/StringRef.h" @@ -29,7 +29,6 @@ private: public: static void Initialize(); - static uint32_t GetMaxThreadNameLength(); static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); static bool GetOSBuildString(std::string &s); diff --git a/include/lldb/Host/linux/HostThreadLinux.h b/include/lldb/Host/linux/HostThreadLinux.h deleted file mode 100644 index ddfa8633ffed..000000000000 --- a/include/lldb/Host/linux/HostThreadLinux.h +++ /dev/null @@ -1,30 +0,0 @@ -//===-- HostThreadLinux.h ---------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_linux_HostThreadLinux_h_ -#define lldb_Host_linux_HostThreadLinux_h_ - -#include "lldb/Host/posix/HostThreadPosix.h" - -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringRef.h" - -namespace lldb_private { - -class HostThreadLinux : public HostThreadPosix { -public: - HostThreadLinux(); - HostThreadLinux(lldb::thread_t thread); - - static void SetName(lldb::thread_t thread, llvm::StringRef name); - static void GetName(lldb::thread_t thread, llvm::SmallVectorImpl<char> &name); -}; -} - -#endif diff --git a/include/lldb/Host/linux/Support.h b/include/lldb/Host/linux/Support.h new file mode 100644 index 000000000000..dae76c78fb4a --- /dev/null +++ b/include/lldb/Host/linux/Support.h @@ -0,0 +1,27 @@ +//===-- Support.h -----------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_HOST_LINUX_SUPPORT_H +#define LLDB_HOST_LINUX_SUPPORT_H + +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/MemoryBuffer.h" +#include <memory> + +namespace lldb_private { + +llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> +getProcFile(::pid_t pid, ::pid_t tid, const llvm::Twine &file); + +llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> +getProcFile(::pid_t pid, const llvm::Twine &file); + +} // namespace lldb_private + +#endif // #ifndef LLDB_HOST_LINUX_SUPPORT_H diff --git a/include/lldb/Host/macosx/Config.h b/include/lldb/Host/macosx/Config.h deleted file mode 100644 index ef8e02cfa4da..000000000000 --- a/include/lldb/Host/macosx/Config.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/include/lldb/Host/macosx/HostInfoMacOSX.h b/include/lldb/Host/macosx/HostInfoMacOSX.h index b182b9bce147..eee842beec87 100644 --- a/include/lldb/Host/macosx/HostInfoMacOSX.h +++ b/include/lldb/Host/macosx/HostInfoMacOSX.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_macosx_HostInfoMacOSX_h_ #define lldb_Host_macosx_HostInfoMacOSX_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { @@ -30,7 +30,6 @@ public: static bool GetOSBuildString(std::string &s); static bool GetOSKernelDescription(std::string &s); static FileSpec GetProgramFileSpec(); - static uint32_t GetMaxThreadNameLength(); protected: static bool ComputeSupportExeDirectory(FileSpec &file_spec); diff --git a/include/lldb/Host/mingw/Config.h b/include/lldb/Host/mingw/Config.h deleted file mode 100644 index 9cf2735ab709..000000000000 --- a/include/lldb/Host/mingw/Config.h +++ /dev/null @@ -1,30 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_DISABLE_POSIX - -//#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -//#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/include/lldb/Host/msvc/Config.h b/include/lldb/Host/msvc/Config.h deleted file mode 100644 index 37dfbf58a854..000000000000 --- a/include/lldb/Host/msvc/Config.h +++ /dev/null @@ -1,39 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_host_msvc_Config_h_ -#define liblldb_host_msvc_Config_h_ - -#define LLDB_DISABLE_POSIX - -//#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -//#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#if _HAS_EXCEPTIONS == 0 -// Due to a bug in <thread>, when _HAS_EXCEPTIONS == 0 the header will try to -// call -// uncaught_exception() without having a declaration for it. The fix for this -// is -// to manually #include <eh.h>, which contains this declaration. -#include <eh.h> -#endif - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/include/lldb/Host/netbsd/Config.h b/include/lldb/Host/netbsd/Config.h deleted file mode 100644 index 1e9f55299d52..000000000000 --- a/include/lldb/Host/netbsd/Config.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/include/lldb/Host/netbsd/HostInfoNetBSD.h b/include/lldb/Host/netbsd/HostInfoNetBSD.h index 684e54e9f052..9ebff6ba6b0e 100644 --- a/include/lldb/Host/netbsd/HostInfoNetBSD.h +++ b/include/lldb/Host/netbsd/HostInfoNetBSD.h @@ -10,14 +10,13 @@ #ifndef lldb_Host_netbsd_HostInfoNetBSD_h_ #define lldb_Host_netbsd_HostInfoNetBSD_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { class HostInfoNetBSD : public HostInfoPosix { public: - static uint32_t GetMaxThreadNameLength(); static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); static bool GetOSBuildString(std::string &s); static bool GetOSKernelDescription(std::string &s); diff --git a/include/lldb/Host/netbsd/HostThreadNetBSD.h b/include/lldb/Host/netbsd/HostThreadNetBSD.h deleted file mode 100644 index 385f014899f7..000000000000 --- a/include/lldb/Host/netbsd/HostThreadNetBSD.h +++ /dev/null @@ -1,30 +0,0 @@ -//===-- HostThreadNetBSD.h -------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_netbsd_HostThreadNetBSD_h_ -#define lldb_Host_netbsd_HostThreadNetBSD_h_ - -#include "lldb/Host/posix/HostThreadPosix.h" - -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringRef.h" - -namespace lldb_private { - -class HostThreadNetBSD : public HostThreadPosix { -public: - HostThreadNetBSD(); - HostThreadNetBSD(lldb::thread_t thread); - - static void SetName(lldb::thread_t tid, llvm::StringRef &name); - static void GetName(lldb::thread_t tid, llvm::SmallVectorImpl<char> &name); -}; -} - -#endif diff --git a/include/lldb/Host/openbsd/HostInfoOpenBSD.h b/include/lldb/Host/openbsd/HostInfoOpenBSD.h new file mode 100644 index 000000000000..5a0388ffdd97 --- /dev/null +++ b/include/lldb/Host/openbsd/HostInfoOpenBSD.h @@ -0,0 +1,27 @@ +//===-- HostInfoOpenBSD.h --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_Host_openbsd_HostInfoOpenBSD_h_ +#define lldb_Host_openbsd_HostInfoOpenBSD_h_ + +#include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" + +namespace lldb_private { + +class HostInfoOpenBSD : public HostInfoPosix { +public: + static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); + static bool GetOSBuildString(std::string &s); + static bool GetOSKernelDescription(std::string &s); + static FileSpec GetProgramFileSpec(); +}; +} + +#endif diff --git a/include/lldb/Host/posix/HostInfoPosix.h b/include/lldb/Host/posix/HostInfoPosix.h index 6d22776e1854..34994aea44fe 100644 --- a/include/lldb/Host/posix/HostInfoPosix.h +++ b/include/lldb/Host/posix/HostInfoPosix.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_posix_HostInfoPosix_h_ #define lldb_Host_posix_HostInfoPosix_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/HostInfoBase.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { diff --git a/include/lldb/Host/posix/HostProcessPosix.h b/include/lldb/Host/posix/HostProcessPosix.h index 1535e679dd53..aed3cccef2e2 100644 --- a/include/lldb/Host/posix/HostProcessPosix.h +++ b/include/lldb/Host/posix/HostProcessPosix.h @@ -14,8 +14,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/Host/HostNativeProcessBase.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-types.h" namespace lldb_private { diff --git a/include/lldb/Host/linux/ProcessLauncherLinux.h b/include/lldb/Host/posix/ProcessLauncherPosixFork.h index 8ad00d091606..77bdab535c1b 100644 --- a/include/lldb/Host/linux/ProcessLauncherLinux.h +++ b/include/lldb/Host/posix/ProcessLauncherPosixFork.h @@ -1,4 +1,4 @@ -//===-- ProcessLauncherAndroid.h --------------------------------*- C++ -*-===// +//===-- ProcessLauncherPosixFork.h ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,17 +7,17 @@ // //===----------------------------------------------------------------------===// -#ifndef lldb_Host_android_ProcessLauncherAndroid_h_ -#define lldb_Host_android_ProcessLauncherAndroid_h_ +#ifndef lldb_Host_posix_ProcessLauncherPosixFork_h_ +#define lldb_Host_posix_ProcessLauncherPosixFork_h_ #include "lldb/Host/ProcessLauncher.h" namespace lldb_private { -class ProcessLauncherLinux : public ProcessLauncher { +class ProcessLauncherPosixFork : public ProcessLauncher { public: - virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error); + HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, + Error &error) override; }; } // end of namespace lldb_private diff --git a/include/lldb/Host/windows/HostInfoWindows.h b/include/lldb/Host/windows/HostInfoWindows.h index 5a5d72c2466c..9dfbf93591ed 100644 --- a/include/lldb/Host/windows/HostInfoWindows.h +++ b/include/lldb/Host/windows/HostInfoWindows.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_windows_HostInfoWindows_h_ #define lldb_Host_windows_HostInfoWindows_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/HostInfoBase.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { diff --git a/include/lldb/Host/windows/PosixApi.h b/include/lldb/Host/windows/PosixApi.h index 4f2573781620..de70266a5efb 100644 --- a/include/lldb/Host/windows/PosixApi.h +++ b/include/lldb/Host/windows/PosixApi.h @@ -82,8 +82,6 @@ char *strcasestr(const char *s, const char *find); char *realpath(const char *name, char *resolved); int usleep(uint32_t useconds); -char *getcwd(char *path, int max); -int chdir(const char *path); char *basename(char *path); char *dirname(char *path); diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h index 6610be14d0dd..bdbf81e02d9d 100644 --- a/include/lldb/Interpreter/Args.h +++ b/include/lldb/Interpreter/Args.h @@ -21,13 +21,14 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" // Project includes -#include "lldb/Core/Error.h" -#include "lldb/Host/OptionParser.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private-types.h" #include "lldb/lldb-types.h" namespace lldb_private { +struct Option; + typedef std::vector<std::tuple<std::string, int, std::string>> OptionArgVector; typedef std::shared_ptr<OptionArgVector> OptionArgVectorSP; @@ -193,6 +194,15 @@ public: const char **GetConstArgumentVector() const; //------------------------------------------------------------------ + /// Gets the argument as an ArrayRef. Note that the return value does *not* + /// have a nullptr const char * at the end, as the size of the list is + /// embedded in the ArrayRef object. + //------------------------------------------------------------------ + llvm::ArrayRef<const char *> GetArgumentArrayRef() const { + return llvm::makeArrayRef(m_argv).drop_back(); + } + + //------------------------------------------------------------------ /// Appends a new argument to the end of the list argument list. /// /// @param[in] arg_cstr diff --git a/include/lldb/Interpreter/CommandCompletions.h b/include/lldb/Interpreter/CommandCompletions.h index 2e117358c399..8bac3e8639d7 100644 --- a/include/lldb/Interpreter/CommandCompletions.h +++ b/include/lldb/Interpreter/CommandCompletions.h @@ -17,11 +17,14 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/FileSpecList.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/SearchFilter.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/lldb-private.h" +#include "llvm/ADT/Twine.h" + namespace lldb_private { +class TildeExpressionResolver; class CommandCompletions { public: //---------------------------------------------------------------------- @@ -76,12 +79,19 @@ public: int max_return_elements, SearchFilter *searcher, bool &word_complete, StringList &matches); + static int DiskFiles(const llvm::Twine &partial_file_name, + StringList &matches, TildeExpressionResolver &Resolver); + static int DiskDirectories(CommandInterpreter &interpreter, llvm::StringRef partial_file_name, int match_start_point, int max_return_elements, SearchFilter *searcher, bool &word_complete, StringList &matches); + static int DiskDirectories(const llvm::Twine &partial_file_name, + StringList &matches, + TildeExpressionResolver &Resolver); + static int SourceFiles(CommandInterpreter &interpreter, llvm::StringRef partial_file_name, int match_start_point, int max_return_elements, diff --git a/include/lldb/Interpreter/CommandHistory.h b/include/lldb/Interpreter/CommandHistory.h index f1a6c855e3b9..faef220bbe94 100644 --- a/include/lldb/Interpreter/CommandHistory.h +++ b/include/lldb/Interpreter/CommandHistory.h @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h index 00dec5134c8f..031ea10d6ad4 100644 --- a/include/lldb/Interpreter/CommandInterpreter.h +++ b/include/lldb/Interpreter/CommandInterpreter.h @@ -19,13 +19,13 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Event.h" #include "lldb/Core/IOHandler.h" -#include "lldb/Core/Log.h" -#include "lldb/Core/StringList.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandAlias.h" #include "lldb/Interpreter/CommandHistory.h" #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/ScriptInterpreter.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Interpreter/CommandObject.h b/include/lldb/Interpreter/CommandObject.h index 9104fd8f9bb7..ff4c829e5c70 100644 --- a/include/lldb/Interpreter/CommandObject.h +++ b/include/lldb/Interpreter/CommandObject.h @@ -18,11 +18,12 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Flags.h" -#include "lldb/Core/StringList.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/CommandObjectRegexCommand.h b/include/lldb/Interpreter/CommandObjectRegexCommand.h index 44dc4f2bfd58..50dbebc21b1d 100644 --- a/include/lldb/Interpreter/CommandObjectRegexCommand.h +++ b/include/lldb/Interpreter/CommandObjectRegexCommand.h @@ -16,8 +16,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/RegularExpression.h" #include "lldb/Interpreter/CommandObject.h" +#include "lldb/Utility/RegularExpression.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/CommandReturnObject.h b/include/lldb/Interpreter/CommandReturnObject.h index 40db5635afa4..8e467e118477 100644 --- a/include/lldb/Interpreter/CommandReturnObject.h +++ b/include/lldb/Interpreter/CommandReturnObject.h @@ -16,8 +16,8 @@ // Project includes #include "lldb/Core/STLUtils.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/StreamTee.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/Utility/StreamTee.h" #include "lldb/lldb-private.h" #include "llvm/ADT/StringRef.h" diff --git a/include/lldb/Interpreter/OptionGroupPlatform.h b/include/lldb/Interpreter/OptionGroupPlatform.h index c51ff5c1f48d..8cee9a671869 100644 --- a/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/include/lldb/Interpreter/OptionGroupPlatform.h @@ -14,8 +14,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValue.h b/include/lldb/Interpreter/OptionValue.h index 2c1d5df90697..648ad33e2fc8 100644 --- a/include/lldb/Interpreter/OptionValue.h +++ b/include/lldb/Interpreter/OptionValue.h @@ -14,10 +14,12 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" #include "lldb/Core/FormatEntity.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-defines.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-private-interfaces.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValueEnumeration.h b/include/lldb/Interpreter/OptionValueEnumeration.h index 273e69cc6d66..d47248b72c67 100644 --- a/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/include/lldb/Interpreter/OptionValueEnumeration.h @@ -10,16 +10,13 @@ #ifndef liblldb_OptionValueEnumeration_h_ #define liblldb_OptionValueEnumeration_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Interpreter/OptionValue.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/lldb-private-types.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValueFileSpec.h b/include/lldb/Interpreter/OptionValueFileSpec.h index 8020aa7fb49d..654c04d4d274 100644 --- a/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/include/lldb/Interpreter/OptionValueFileSpec.h @@ -12,7 +12,7 @@ #include "lldb/Interpreter/OptionValue.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "llvm/Support/Chrono.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValueProperties.h b/include/lldb/Interpreter/OptionValueProperties.h index bb4202a2ec1f..0b49e0b00672 100644 --- a/include/lldb/Interpreter/OptionValueProperties.h +++ b/include/lldb/Interpreter/OptionValueProperties.h @@ -16,11 +16,11 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Core/FormatEntity.h" #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Interpreter/Property.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValueRegex.h b/include/lldb/Interpreter/OptionValueRegex.h index 7125daffedee..7bb8d419bde0 100644 --- a/include/lldb/Interpreter/OptionValueRegex.h +++ b/include/lldb/Interpreter/OptionValueRegex.h @@ -14,8 +14,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/RegularExpression.h" #include "lldb/Interpreter/OptionValue.h" +#include "lldb/Utility/RegularExpression.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValueString.h b/include/lldb/Interpreter/OptionValueString.h index 5b42003f383f..18b8215fe3c7 100644 --- a/include/lldb/Interpreter/OptionValueString.h +++ b/include/lldb/Interpreter/OptionValueString.h @@ -16,7 +16,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Interpreter/OptionValue.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValueUUID.h b/include/lldb/Interpreter/OptionValueUUID.h index 841de88f9263..62c25859580c 100644 --- a/include/lldb/Interpreter/OptionValueUUID.h +++ b/include/lldb/Interpreter/OptionValueUUID.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/UUID.h" +#include "lldb/Utility/UUID.h" #include "lldb/Interpreter/OptionValue.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/Property.h b/include/lldb/Interpreter/Property.h index e09df5cf9dad..9d0dc5fa0fd8 100644 --- a/include/lldb/Interpreter/Property.h +++ b/include/lldb/Interpreter/Property.h @@ -10,16 +10,13 @@ #ifndef liblldb_Property_h_ #define liblldb_Property_h_ -// C Includes -// C++ Includes -#include <string> - -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Flags.h" #include "lldb/Interpreter/OptionValue.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Flags.h" #include "lldb/lldb-defines.h" +#include "lldb/lldb-private-types.h" + +#include <string> namespace lldb_private { diff --git a/include/lldb/Interpreter/ScriptInterpreter.h b/include/lldb/Interpreter/ScriptInterpreter.h index 3fdba0818535..271a5bba761e 100644 --- a/include/lldb/Interpreter/ScriptInterpreter.h +++ b/include/lldb/Interpreter/ScriptInterpreter.h @@ -18,11 +18,11 @@ #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Core/Broadcaster.h" -#include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/StructuredData.h" +#include "lldb/Utility/Error.h" -#include "lldb/Utility/PseudoTerminal.h" +#include "lldb/Host/PseudoTerminal.h" namespace lldb_private { diff --git a/include/lldb/Symbol/ArmUnwindInfo.h b/include/lldb/Symbol/ArmUnwindInfo.h index cc80c0fa9663..ef67a31e7d0d 100644 --- a/include/lldb/Symbol/ArmUnwindInfo.h +++ b/include/lldb/Symbol/ArmUnwindInfo.h @@ -12,9 +12,9 @@ #include <vector> -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/RangeMap.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Utility/DataExtractor.h" #include "lldb/lldb-private.h" /* diff --git a/include/lldb/Symbol/Block.h b/include/lldb/Symbol/Block.h index eb96318dac04..a5387cca21c5 100644 --- a/include/lldb/Symbol/Block.h +++ b/include/lldb/Symbol/Block.h @@ -18,11 +18,12 @@ // Project includes #include "lldb/Core/AddressRange.h" #include "lldb/Core/RangeMap.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/SymbolContextScope.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h index 4262ecb4bf0e..ef1659159697 100644 --- a/include/lldb/Symbol/ClangASTContext.h +++ b/include/lldb/Symbol/ClangASTContext.h @@ -31,9 +31,9 @@ // Project includes #include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "lldb/Core/ClangForward.h" -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-enumerations.h" class DWARFASTParserClang; diff --git a/include/lldb/Symbol/CompactUnwindInfo.h b/include/lldb/Symbol/CompactUnwindInfo.h index 133a886812b3..630067241735 100644 --- a/include/lldb/Symbol/CompactUnwindInfo.h +++ b/include/lldb/Symbol/CompactUnwindInfo.h @@ -13,10 +13,10 @@ #include <mutex> #include <vector> -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/RangeMap.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Utility/DataExtractor.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/CompileUnit.h b/include/lldb/Symbol/CompileUnit.h index 8465f3bb5777..e7a1ebc8c00f 100644 --- a/include/lldb/Symbol/CompileUnit.h +++ b/include/lldb/Symbol/CompileUnit.h @@ -12,10 +12,10 @@ #include "lldb/Core/FileSpecList.h" #include "lldb/Core/ModuleChild.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/DebugMacros.h" #include "lldb/Symbol/Function.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-enumerations.h" namespace lldb_private { diff --git a/include/lldb/Symbol/CompilerDecl.h b/include/lldb/Symbol/CompilerDecl.h index a612fb689c81..5d744d999bea 100644 --- a/include/lldb/Symbol/CompilerDecl.h +++ b/include/lldb/Symbol/CompilerDecl.h @@ -10,8 +10,8 @@ #ifndef liblldb_CompilerDecl_h_ #define liblldb_CompilerDecl_h_ -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/CompilerDeclContext.h b/include/lldb/Symbol/CompilerDeclContext.h index e4f3e7459aa7..179a1be0248b 100644 --- a/include/lldb/Symbol/CompilerDeclContext.h +++ b/include/lldb/Symbol/CompilerDeclContext.h @@ -12,7 +12,7 @@ #include <vector> -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/CompilerType.h b/include/lldb/Symbol/CompilerType.h index 68221609c0cb..c5bca54ed43f 100644 --- a/include/lldb/Symbol/CompilerType.h +++ b/include/lldb/Symbol/CompilerType.h @@ -23,6 +23,8 @@ namespace lldb_private { +class DataExtractor; + //---------------------------------------------------------------------- // A class that can carry around a clang ASTContext and a opaque clang // QualType. A clang::QualType can be easily reconstructed from an diff --git a/include/lldb/Symbol/DWARFCallFrameInfo.h b/include/lldb/Symbol/DWARFCallFrameInfo.h index c221a36bd6c8..085def8ff0e5 100644 --- a/include/lldb/Symbol/DWARFCallFrameInfo.h +++ b/include/lldb/Symbol/DWARFCallFrameInfo.h @@ -14,13 +14,13 @@ #include <mutex> #include "lldb/Core/AddressRange.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Core/RangeMap.h" -#include "lldb/Core/VMRange.h" #include "lldb/Core/dwarf.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Utility/VMRange.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/DebugMacros.h b/include/lldb/Symbol/DebugMacros.h index 4d4a3273db64..640da027cd59 100644 --- a/include/lldb/Symbol/DebugMacros.h +++ b/include/lldb/Symbol/DebugMacros.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/DeclVendor.h b/include/lldb/Symbol/DeclVendor.h index 5ee8b19b6ed0..16d514fdf1bd 100644 --- a/include/lldb/Symbol/DeclVendor.h +++ b/include/lldb/Symbol/DeclVendor.h @@ -11,6 +11,7 @@ #define liblldb_DeclVendor_h_ #include "lldb/Core/ClangForward.h" +#include "lldb/lldb-defines.h" #include <vector> diff --git a/include/lldb/Symbol/Declaration.h b/include/lldb/Symbol/Declaration.h index 1846e2fdca82..581176e23961 100644 --- a/include/lldb/Symbol/Declaration.h +++ b/include/lldb/Symbol/Declaration.h @@ -10,7 +10,7 @@ #ifndef liblldb_Declaration_h_ #define liblldb_Declaration_h_ -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/Function.h b/include/lldb/Symbol/Function.h index 232d0790f492..9d376007a411 100644 --- a/include/lldb/Symbol/Function.h +++ b/include/lldb/Symbol/Function.h @@ -12,10 +12,10 @@ #include "lldb/Core/AddressRange.h" #include "lldb/Core/Mangled.h" -#include "lldb/Core/UserID.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Block.h" #include "lldb/Symbol/Declaration.h" +#include "lldb/Utility/UserID.h" namespace lldb_private { diff --git a/include/lldb/Symbol/GoASTContext.h b/include/lldb/Symbol/GoASTContext.h index 5530a35493dc..6feac7abf162 100644 --- a/include/lldb/Symbol/GoASTContext.h +++ b/include/lldb/Symbol/GoASTContext.h @@ -20,9 +20,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/Symbol/JavaASTContext.h b/include/lldb/Symbol/JavaASTContext.h index 6e97674847f4..4fdd2371b67e 100644 --- a/include/lldb/Symbol/JavaASTContext.h +++ b/include/lldb/Symbol/JavaASTContext.h @@ -18,8 +18,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/Symbol/LineEntry.h b/include/lldb/Symbol/LineEntry.h index 3076ec41d878..b9a1a1442d47 100644 --- a/include/lldb/Symbol/LineEntry.h +++ b/include/lldb/Symbol/LineEntry.h @@ -11,7 +11,7 @@ #define liblldb_LineEntry_h_ #include "lldb/Core/AddressRange.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/OCamlASTContext.h b/include/lldb/Symbol/OCamlASTContext.h index 9560866d33e6..a261d43519e0 100644 --- a/include/lldb/Symbol/OCamlASTContext.h +++ b/include/lldb/Symbol/OCamlASTContext.h @@ -21,9 +21,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/Symbol/ObjectContainer.h b/include/lldb/Symbol/ObjectContainer.h index 6f38b50ba567..110379234fb5 100644 --- a/include/lldb/Symbol/ObjectContainer.h +++ b/include/lldb/Symbol/ObjectContainer.h @@ -14,11 +14,11 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/ModuleChild.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Host/Endian.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h index e2e4500ace46..03564eca4b58 100644 --- a/include/lldb/Symbol/ObjectFile.h +++ b/include/lldb/Symbol/ObjectFile.h @@ -10,14 +10,15 @@ #ifndef liblldb_ObjectFile_h_ #define liblldb_ObjectFile_h_ -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/FileSpecList.h" #include "lldb/Core/ModuleChild.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Host/Endian.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Symbol/Symtab.h" #include "lldb/Symbol/UnwindTable.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -563,6 +564,45 @@ public: virtual uint32_t GetNumThreadContexts() { return 0; } + //------------------------------------------------------------------ + /// Some object files may have an identifier string embedded in them, + /// e.g. in a Mach-O core file using the LC_IDENT load command (which + /// is obsolete, but can still be found in some old files) + /// + /// @return + /// Returns the identifier string if one exists, else an empty + /// string. + //------------------------------------------------------------------ + virtual std::string GetIdentifierString () { + return std::string(); + } + + //------------------------------------------------------------------ + /// When the ObjectFile is a core file, lldb needs to locate the + /// "binary" in the core file. lldb can iterate over the pages looking + /// for a valid binary, but some core files may have metadata + /// describing where the main binary is exactly which removes ambiguity + /// when there are multiple binaries present in the captured memory pages. + /// + /// @param[out] address + /// If the address of the binary is specified, this will be set. + /// This is an address is the virtual address space of the core file + /// memory segments; it is not an offset into the object file. + /// If no address is available, will be set to LLDB_INVALID_ADDRESS. + /// + /// @param[out] uuid + /// If the uuid of the binary is specified, this will be set. + /// If no UUID is available, will be cleared. + /// + /// @return + /// Returns true if either address or uuid has been set. + //------------------------------------------------------------------ + virtual bool GetCorefileMainBinaryInfo (lldb::addr_t &address, UUID &uuid) { + address = LLDB_INVALID_ADDRESS; + uuid.Clear(); + return false; + } + virtual lldb::RegisterContextSP GetThreadContextAtIndex(uint32_t idx, lldb_private::Thread &thread) { return lldb::RegisterContextSP(); @@ -774,6 +814,20 @@ public: llvm::StringRef name, lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined); + //------------------------------------------------------------------ + /// Loads this objfile to memory. + /// + /// Loads the bits needed to create an executable image to the memory. + /// It is useful with bare-metal targets where target does not have the + /// ability to start a process itself. + /// + /// @param[in] target + /// Target where to load. + /// + /// @return + //------------------------------------------------------------------ + virtual Error LoadInMemory(Target &target, bool set_pc); + protected: //------------------------------------------------------------------ // Member variables. diff --git a/include/lldb/Symbol/Symbol.h b/include/lldb/Symbol/Symbol.h index 3f12b9a99b04..44c67f6f4716 100644 --- a/include/lldb/Symbol/Symbol.h +++ b/include/lldb/Symbol/Symbol.h @@ -12,8 +12,8 @@ #include "lldb/Core/AddressRange.h" #include "lldb/Core/Mangled.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/SymbolContextScope.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h index b2a65fabf8f9..9740dc25a587 100644 --- a/include/lldb/Symbol/Type.h +++ b/include/lldb/Symbol/Type.h @@ -11,11 +11,11 @@ #define liblldb_Type_h_ #include "lldb/Core/ClangForward.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/CompilerDecl.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Declaration.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" #include "llvm/ADT/APSInt.h" @@ -23,7 +23,6 @@ #include <set> namespace lldb_private { - //---------------------------------------------------------------------- // CompilerContext allows an array of these items to be passed to // perform detailed lookups in SymbolVendor and SymbolFile functions. diff --git a/include/lldb/Symbol/UnwindPlan.h b/include/lldb/Symbol/UnwindPlan.h index dfcf55bc8864..abb57a2c499d 100644 --- a/include/lldb/Symbol/UnwindPlan.h +++ b/include/lldb/Symbol/UnwindPlan.h @@ -19,8 +19,8 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/AddressRange.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Stream.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Symbol/Variable.h b/include/lldb/Symbol/Variable.h index 33249891d36b..f076a04434e1 100644 --- a/include/lldb/Symbol/Variable.h +++ b/include/lldb/Symbol/Variable.h @@ -15,9 +15,9 @@ #include "lldb/Core/Mangled.h" #include "lldb/Core/RangeMap.h" -#include "lldb/Core/UserID.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Declaration.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-private.h" diff --git a/include/lldb/Target/ABI.h b/include/lldb/Target/ABI.h index 8a1243613616..4b611d244e21 100644 --- a/include/lldb/Target/ABI.h +++ b/include/lldb/Target/ABI.h @@ -14,9 +14,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Utility/Error.h" #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" diff --git a/include/lldb/Target/DynamicLoader.h b/include/lldb/Target/DynamicLoader.h index 071cbe69d880..ced6ef44000a 100644 --- a/include/lldb/Target/DynamicLoader.h +++ b/include/lldb/Target/DynamicLoader.h @@ -11,10 +11,38 @@ #define liblldb_DynamicLoader_h_ // Project includes -#include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/UUID.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/UUID.h" +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-forward.h" // for ModuleSP, ThreadPlanSP +#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz... +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for int64_t +namespace lldb_private { +class ModuleList; +} +namespace lldb_private { +class Process; +} +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Symbol; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class Thread; +} namespace lldb_private { @@ -331,6 +359,10 @@ protected: // Read a pointer from memory at the given addr. // Return LLDB_INVALID_ADDRESS if the read fails. lldb::addr_t ReadPointer(lldb::addr_t addr); + + // Calls into the Process protected method LoadOperatingSystemPlugin: + void LoadOperatingSystemPlugin(bool flush); + //------------------------------------------------------------------ // Member variables. diff --git a/include/lldb/Target/FileAction.h b/include/lldb/Target/FileAction.h index 81122ec68798..f80f57ac588b 100644 --- a/include/lldb/Target/FileAction.h +++ b/include/lldb/Target/FileAction.h @@ -10,7 +10,7 @@ #ifndef liblldb_Target_FileAction_h #define liblldb_Target_FileAction_h -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include <string> namespace lldb_private { diff --git a/include/lldb/Target/Memory.h b/include/lldb/Target/Memory.h index 57275bbda593..f0a4bc5881f0 100644 --- a/include/lldb/Target/Memory.h +++ b/include/lldb/Target/Memory.h @@ -75,6 +75,8 @@ private: DISALLOW_COPY_AND_ASSIGN(MemoryCache); }; + + class AllocatedBlock { public: AllocatedBlock(lldb::addr_t addr, uint32_t byte_size, uint32_t permissions, @@ -86,32 +88,34 @@ public: bool FreeBlock(lldb::addr_t addr); - lldb::addr_t GetBaseAddress() const { return m_addr; } + lldb::addr_t GetBaseAddress() const { return m_range.GetRangeBase(); } - uint32_t GetByteSize() const { return m_byte_size; } + uint32_t GetByteSize() const { return m_range.GetByteSize(); } uint32_t GetPermissions() const { return m_permissions; } uint32_t GetChunkSize() const { return m_chunk_size; } bool Contains(lldb::addr_t addr) const { - return ((addr >= m_addr) && addr < (m_addr + m_byte_size)); + return m_range.Contains(addr); } protected: - uint32_t TotalChunks() const { return m_byte_size / m_chunk_size; } + uint32_t TotalChunks() const { return GetByteSize() / GetChunkSize(); } uint32_t CalculateChunksNeededForSize(uint32_t size) const { return (size + m_chunk_size - 1) / m_chunk_size; } - const lldb::addr_t m_addr; // Base address of this block of memory - const uint32_t m_byte_size; // 4GB of chunk should be enough... - const uint32_t m_permissions; // Permissions for this memory (logical OR of - // lldb::Permissions bits) - const uint32_t m_chunk_size; // The size of chunks that the memory at m_addr - // is divied up into - typedef std::map<uint32_t, uint32_t> OffsetToChunkSize; - OffsetToChunkSize m_offset_to_chunk_size; + // Base address of this block of memory 4GB of chunk should be enough. + Range<lldb::addr_t, uint32_t> m_range; + // Permissions for this memory (logical OR of lldb::Permissions bits) + const uint32_t m_permissions; + // The size of chunks that the memory at m_addr is divied up into. + const uint32_t m_chunk_size; + // A sorted list of free address ranges. + RangeVector<lldb::addr_t, uint32_t> m_free_blocks; + // A sorted list of reserved address. + RangeVector<lldb::addr_t, uint32_t> m_reserved_blocks; }; //---------------------------------------------------------------------- diff --git a/include/lldb/Target/MemoryRegionInfo.h b/include/lldb/Target/MemoryRegionInfo.h index be0cfa429b8f..0824b2442acc 100644 --- a/include/lldb/Target/MemoryRegionInfo.h +++ b/include/lldb/Target/MemoryRegionInfo.h @@ -11,8 +11,9 @@ #ifndef lldb_MemoryRegionInfo_h #define lldb_MemoryRegionInfo_h -#include "lldb/Core/ConstString.h" #include "lldb/Core/RangeMap.h" +#include "llvm/Support/FormatProviders.h" +#include "lldb/Utility/ConstString.h" #include "lldb/Utility/Range.h" namespace lldb_private { @@ -100,4 +101,24 @@ protected: }; } +namespace llvm { +template <> +struct format_provider<lldb_private::MemoryRegionInfo::OptionalBool> { + static void format(const lldb_private::MemoryRegionInfo::OptionalBool &B, + raw_ostream &OS, StringRef Options) { + switch(B) { + case lldb_private::MemoryRegionInfo::eNo: + OS << "no"; + return; + case lldb_private::MemoryRegionInfo::eYes: + OS << "yes"; + return; + case lldb_private::MemoryRegionInfo::eDontKnow: + OS << "don't know"; + return; + } + } +}; +} + #endif // #ifndef lldb_MemoryRegionInfo_h diff --git a/include/lldb/Target/ModuleCache.h b/include/lldb/Target/ModuleCache.h new file mode 100644 index 000000000000..49a7c97c60c3 --- /dev/null +++ b/include/lldb/Target/ModuleCache.h @@ -0,0 +1,76 @@ +//===-- ModuleCache.h -------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_TARGET_MODULECACHE_H +#define LLDB_TARGET_MODULECACHE_H + +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" + +#include "lldb/Host/File.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/FileSpec.h" + +#include <functional> +#include <string> +#include <unordered_map> + +namespace lldb_private { + +class Module; +class UUID; + +//---------------------------------------------------------------------- +/// @class ModuleCache ModuleCache.h "lldb/Target/ModuleCache.h" +/// @brief A module cache class. +/// +/// Caches locally modules that are downloaded from remote targets. +/// Each cached module maintains 2 views: +/// - UUID view: +/// /${CACHE_ROOT}/${PLATFORM_NAME}/.cache/${UUID}/${MODULE_FILENAME} +/// - Sysroot view: +/// /${CACHE_ROOT}/${PLATFORM_NAME}/${HOSTNAME}/${MODULE_FULL_FILEPATH} +/// +/// UUID views stores a real module file, whereas Sysroot view holds a symbolic +/// link to UUID-view file. +/// +/// Example: +/// UUID view : +/// /tmp/lldb/remote-linux/.cache/30C94DC6-6A1F-E951-80C3-D68D2B89E576-D5AE213C/libc.so.6 +/// Sysroot view: /tmp/lldb/remote-linux/ubuntu/lib/x86_64-linux-gnu/libc.so.6 +//---------------------------------------------------------------------- + +class ModuleCache { +public: + using ModuleDownloader = + std::function<Error(const ModuleSpec &, const FileSpec &)>; + using SymfileDownloader = + std::function<Error(const lldb::ModuleSP &, const FileSpec &)>; + + Error GetAndPut(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, + const ModuleDownloader &module_downloader, + const SymfileDownloader &symfile_downloader, + lldb::ModuleSP &cached_module_sp, bool *did_create_ptr); + +private: + Error Put(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, const FileSpec &tmp_file, + const FileSpec &target_file); + + Error Get(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, lldb::ModuleSP &cached_module_sp, + bool *did_create_ptr); + + std::unordered_map<std::string, lldb::ModuleWP> m_loaded_modules; +}; + +} // namespace lldb_private + +#endif // utility_ModuleCache_h_ diff --git a/include/lldb/Target/PathMappingList.h b/include/lldb/Target/PathMappingList.h index 4e5a5693235a..2b844882e4ad 100644 --- a/include/lldb/Target/PathMappingList.h +++ b/include/lldb/Target/PathMappingList.h @@ -15,8 +15,8 @@ #include <map> #include <vector> // Other libraries and framework includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Error.h" // Project includes namespace lldb_private { diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h index 9707093440a5..fb05d3e06dd5 100644 --- a/include/lldb/Target/Platform.h +++ b/include/lldb/Target/Platform.h @@ -22,11 +22,11 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/ConstString.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/UserSettingsController.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-public.h" diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h index 251dfe6a17c0..56bbbfd53fdd 100644 --- a/include/lldb/Target/Process.h +++ b/include/lldb/Target/Process.h @@ -30,7 +30,6 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Communication.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Event.h" #include "lldb/Core/Listener.h" #include "lldb/Core/LoadedModuleInfoList.h" @@ -48,6 +47,8 @@ #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/QueueList.h" #include "lldb/Target/ThreadList.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/NameMatches.h" #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" @@ -305,11 +306,11 @@ public: class ProcessInstanceInfoMatch { public: ProcessInstanceInfoMatch() - : m_match_info(), m_name_match_type(eNameMatchIgnore), + : m_match_info(), m_name_match_type(NameMatch::Ignore), m_match_all_users(false) {} ProcessInstanceInfoMatch(const char *process_name, - NameMatchType process_name_match_type) + NameMatch process_name_match_type) : m_match_info(), m_name_match_type(process_name_match_type), m_match_all_users(false) { m_match_info.GetExecutableFile().SetFile(process_name, false); @@ -323,9 +324,9 @@ public: void SetMatchAllUsers(bool b) { m_match_all_users = b; } - NameMatchType GetNameMatchType() const { return m_name_match_type; } + NameMatch GetNameMatchType() const { return m_name_match_type; } - void SetNameMatchType(NameMatchType name_match_type) { + void SetNameMatchType(NameMatch name_match_type) { m_name_match_type = name_match_type; } @@ -338,7 +339,7 @@ public: protected: ProcessInstanceInfo m_match_info; - NameMatchType m_name_match_type; + NameMatch m_name_match_type; bool m_match_all_users; }; @@ -504,6 +505,7 @@ class Process : public std::enable_shared_from_this<Process>, public PluginInterface { friend class FunctionCaller; // For WaitForStateChangeEventsPrivate friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive + friend class DynamicLoader; // For LoadOperatingSystemPlugin friend class ProcessEventData; friend class StopInfo; friend class Target; @@ -2605,7 +2607,7 @@ public: bool RunPreResumeActions(); void ClearPreResumeActions(); - + void ClearPreResumeAction(PreResumeActionCallback callback, void *baton); ProcessRunLock &GetRunLock(); @@ -3143,6 +3145,8 @@ protected: Error StopForDestroyOrDetach(lldb::EventSP &exit_event_sp); + virtual Error UpdateAutomaticSignalFiltering(); + bool StateChangedIsExternallyHijacked(); void LoadOperatingSystemPlugin(bool flush); diff --git a/include/lldb/Target/ProcessInfo.h b/include/lldb/Target/ProcessInfo.h index f8d37fa4ebb4..03b15242f7ee 100644 --- a/include/lldb/Target/ProcessInfo.h +++ b/include/lldb/Target/ProcessInfo.h @@ -12,8 +12,8 @@ // LLDB headers #include "lldb/Core/ArchSpec.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h index 2c192c24da87..083e0bbed8bd 100644 --- a/include/lldb/Target/ProcessLaunchInfo.h +++ b/include/lldb/Target/ProcessLaunchInfo.h @@ -14,12 +14,13 @@ #include <string> // LLDB Headers -#include "lldb/Core/Flags.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Host/Host.h" +#include "lldb/Host/PseudoTerminal.h" #include "lldb/Target/FileAction.h" #include "lldb/Target/ProcessInfo.h" -#include "lldb/Utility/PseudoTerminal.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { diff --git a/include/lldb/Utility/ProcessStructReader.h b/include/lldb/Target/ProcessStructReader.h index eb5126329bc0..acc5c1f32686 100644 --- a/include/lldb/Utility/ProcessStructReader.h +++ b/include/lldb/Target/ProcessStructReader.h @@ -1,5 +1,4 @@ -//===---------------------ProcessStructReader.h ------------------*- C++ -//-*-===// +//===---------------------ProcessStructReader.h ------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -8,17 +7,17 @@ // //===----------------------------------------------------------------------===// -#ifndef utility_ProcessStructReader_h_ -#define utility_ProcessStructReader_h_ +#ifndef LLDB_TARGET_PROCESSSTRUCTREADER_H +#define LLDB_TARGET_PROCESSSTRUCTREADER_H #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Error.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Process.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Error.h" #include <initializer_list> #include <map> diff --git a/include/lldb/Target/QueueItem.h b/include/lldb/Target/QueueItem.h index f6378502c19c..acbf94e1b0f9 100644 --- a/include/lldb/Target/QueueItem.h +++ b/include/lldb/Target/QueueItem.h @@ -23,7 +23,7 @@ #include "lldb/lldb-private.h" #include "lldb/Core/Address.h" -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/include/lldb/Target/QueueList.h b/include/lldb/Target/QueueList.h index 038463d9ab02..91cf3eb6d4c2 100644 --- a/include/lldb/Target/QueueList.h +++ b/include/lldb/Target/QueueList.h @@ -13,8 +13,8 @@ #include <mutex> #include <vector> -#include "lldb/Core/UserID.h" #include "lldb/Utility/Iterable.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Target/RegisterCheckpoint.h b/include/lldb/Target/RegisterCheckpoint.h index 8391cadcdf66..578cf25eef25 100644 --- a/include/lldb/Target/RegisterCheckpoint.h +++ b/include/lldb/Target/RegisterCheckpoint.h @@ -10,8 +10,8 @@ #ifndef liblldb_RegisterCheckpoint_h_ #define liblldb_RegisterCheckpoint_h_ -#include "lldb/Core/UserID.h" #include "lldb/Target/StackID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Utility/RegisterNumber.h b/include/lldb/Target/RegisterNumber.h index b3845ac0d46b..5649c8022ee7 100644 --- a/include/lldb/Utility/RegisterNumber.h +++ b/include/lldb/Target/RegisterNumber.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_RegisterNumber_h -#define liblldb_RegisterNumber_h +#ifndef LLDB_TARGET_REGISTERNUMBER_H +#define LLDB_TARGET_REGISTERNUMBER_H #include "lldb/lldb-private.h" #include <map> diff --git a/include/lldb/Target/StackFrame.h b/include/lldb/Target/StackFrame.h index 34bd187b776c..1f25575e236a 100644 --- a/include/lldb/Target/StackFrame.h +++ b/include/lldb/Target/StackFrame.h @@ -17,15 +17,16 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Core/Scalar.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/StackID.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/Utility/UserID.h" namespace lldb_private { diff --git a/include/lldb/Target/SystemRuntime.h b/include/lldb/Target/SystemRuntime.h index 3a2a544fe0b0..f50c9c1b4a56 100644 --- a/include/lldb/Target/SystemRuntime.h +++ b/include/lldb/Target/SystemRuntime.h @@ -16,12 +16,12 @@ // Project includes #include <vector> -#include "lldb/Core/ConstString.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/StructuredData.h" #include "lldb/Target/QueueItem.h" #include "lldb/Target/QueueList.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" diff --git a/include/lldb/Target/Thread.h b/include/lldb/Target/Thread.h index 63449bbf930e..47d0b7d767d6 100644 --- a/include/lldb/Target/Thread.h +++ b/include/lldb/Target/Thread.h @@ -22,11 +22,11 @@ #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Event.h" #include "lldb/Core/StructuredData.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/RegisterCheckpoint.h" #include "lldb/Target/StackFrameList.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" #define LLDB_THREAD_MAX_STOP_EXC_DATA 8 @@ -126,6 +126,7 @@ public: // bit of data. lldb::StopInfoSP stop_info_sp; // You have to restore the stop info or you // might continue with the wrong signals. + std::vector<lldb::ThreadPlanSP> m_completed_plan_stack; lldb::RegisterCheckpointSP register_backup_sp; // You need to restore the registers, of course... uint32_t current_inlined_depth; @@ -1029,6 +1030,15 @@ public: bool WasThreadPlanDiscarded(ThreadPlan *plan); //------------------------------------------------------------------ + /// Check if we have completed plan to override breakpoint stop reason + /// + /// @return + /// Returns true if completed plan stack is not empty + /// false otherwise. + //------------------------------------------------------------------ + bool CompletedPlanOverridesBreakpoint(); + + //------------------------------------------------------------------ /// Queues a generic thread plan. /// /// @param[in] plan_sp @@ -1213,6 +1223,8 @@ public: void SetStopInfo(const lldb::StopInfoSP &stop_info_sp); + void ResetStopInfo(); + void SetShouldReportStop(Vote vote); //---------------------------------------------------------------------- diff --git a/include/lldb/Target/ThreadList.h b/include/lldb/Target/ThreadList.h index 9e3c940c3c2d..2ebcd0b0e2c9 100644 --- a/include/lldb/Target/ThreadList.h +++ b/include/lldb/Target/ThreadList.h @@ -13,10 +13,10 @@ #include <mutex> #include <vector> -#include "lldb/Core/UserID.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadCollection.h" #include "lldb/Utility/Iterable.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Target/ThreadPlan.h b/include/lldb/Target/ThreadPlan.h index fd25cd08f2ba..acc63ffe562b 100644 --- a/include/lldb/Target/ThreadPlan.h +++ b/include/lldb/Target/ThreadPlan.h @@ -17,12 +17,12 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/UserID.h" #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanTracer.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -40,9 +40,10 @@ namespace lldb_private { // The thread maintaining a thread plan stack, and you program the actions of a // particular thread // by pushing plans onto the plan stack. -// There is always a "Current" plan, which is the head of the plan stack, +// There is always a "Current" plan, which is the top of the plan stack, // though in some cases -// a plan may defer to plans higher in the stack for some piece of information. +// a plan may defer to plans higher in the stack for some piece of information +// (let us define that the plan stack grows downwards). // // The plan stack is never empty, there is always a Base Plan which persists // through the life @@ -109,6 +110,15 @@ namespace lldb_private { // plans in the time between when // your plan gets unshipped and the next resume. // +// Thread State Checkpoint: +// +// Note that calling functions on target process (ThreadPlanCallFunction) changes +// current thread state. The function can be called either by direct user demand or +// internally, for example lldb allocates memory on device to calculate breakpoint +// condition expression - on Linux it is performed by calling mmap on device. +// ThreadStateCheckpoint saves Thread state (stop info and completed +// plan stack) to restore it after completing function call. +// // Over the lifetime of the plan, various methods of the ThreadPlan are then // called in response to changes of state in // the process we are debugging as follows: @@ -149,7 +159,7 @@ namespace lldb_private { // If the Current plan answers "true" then it is asked if the stop should // percolate all the way to the // user by calling the ShouldStop method. If the current plan doesn't explain -// the stop, then we query down +// the stop, then we query up // the plan stack for a plan that does explain the stop. The plan that does // explain the stop then needs to // figure out what to do about the plans below it in the stack. If the stop is @@ -170,7 +180,7 @@ namespace lldb_private { // event it didn't directly handle // it can designate itself a "Master" plan by responding true to IsMasterPlan, // and then if it wants not to be -// discarded, it can return true to OkayToDiscard, and it and all its dependent +// discarded, it can return false to OkayToDiscard, and it and all its dependent // plans will be preserved when // we resume execution. // @@ -207,7 +217,7 @@ namespace lldb_private { // // If a plan says responds "true" to ShouldStop, then it is asked if it's job // is complete by calling -// MischiefManaged. If that returns true, the thread is popped from the plan +// MischiefManaged. If that returns true, the plan is popped from the plan // stack and added to the // Completed Plan Stack. Then the next plan in the stack is asked if it // ShouldStop, and it returns "true", @@ -241,9 +251,9 @@ namespace lldb_private { // // When the process stops, the thread is given a StopReason, in the form of a // StopInfo object. If there is a completed -// plan corresponding to the stop, then the "actual" stop reason will be +// plan corresponding to the stop, then the "actual" stop reason can be // suppressed, and instead a StopInfoThreadPlan -// object will be cons'ed up from the highest completed plan in the stack. +// object will be cons'ed up from the top completed plan in the stack. // However, if the plan doesn't want to be // the stop reason, then it can call SetPlanComplete and pass in "false" for // the "success" parameter. In that case, diff --git a/include/lldb/Target/ThreadPlanPython.h b/include/lldb/Target/ThreadPlanPython.h index a053b5bcb77d..9b7e5d029912 100644 --- a/include/lldb/Target/ThreadPlanPython.h +++ b/include/lldb/Target/ThreadPlanPython.h @@ -18,13 +18,13 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/StructuredData.h" -#include "lldb/Core/UserID.h" #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanTracer.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Target/UnixSignals.h b/include/lldb/Target/UnixSignals.h index 1c58d6452b5f..a209f3549aed 100644 --- a/include/lldb/Target/UnixSignals.h +++ b/include/lldb/Target/UnixSignals.h @@ -14,11 +14,13 @@ // C++ Includes #include <map> #include <string> +#include <vector> // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" +#include "llvm/ADT/Optional.h" namespace lldb_private { @@ -88,6 +90,19 @@ public: void RemoveSignal(int signo); + // Returns a current version of the data stored in this class. + // Version gets incremented each time Set... method is called. + uint64_t GetVersion() const; + + // Returns a vector of signals that meet criteria provided in arguments. + // Each should_[suppress|stop|notify] flag can be + // None - no filtering by this flag + // true - only signals that have it set to true are returned + // false - only signals that have it set to true are returned + std::vector<int32_t> GetFilteredSignals(llvm::Optional<bool> should_suppress, + llvm::Optional<bool> should_stop, + llvm::Optional<bool> should_notify); + protected: //------------------------------------------------------------------ // Classes that inherit from UnixSignals can see and modify these @@ -111,6 +126,12 @@ protected: collection m_signals; + // This version gets incremented every time something is changing in + // this class, including when we call AddSignal from the constructor. + // So after the object is constructed m_version is going to be > 0 + // if it has at least one signal registered in it. + uint64_t m_version = 0; + // GDBRemote signals need to be copyable. UnixSignals(const UnixSignals &rhs); diff --git a/include/lldb/Core/Baton.h b/include/lldb/Utility/Baton.h index c2ab9f74907d..065f2960962d 100644 --- a/include/lldb/Core/Baton.h +++ b/include/lldb/Utility/Baton.h @@ -10,12 +10,15 @@ #ifndef lldb_Baton_h_ #define lldb_Baton_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/lldb-enumerations.h" // for DescriptionLevel #include "lldb/lldb-public.h" +#include <memory> // for unique_ptr + +namespace lldb_private { +class Stream; +} + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/include/lldb/Core/ConstString.h b/include/lldb/Utility/ConstString.h index c6531cab3cf6..fbf1a9bf536e 100644 --- a/include/lldb/Core/ConstString.h +++ b/include/lldb/Utility/ConstString.h @@ -10,18 +10,22 @@ #ifndef liblldb_ConstString_h_ #define liblldb_ConstString_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes #include "llvm/ADT/StringRef.h" +#include "llvm/Support/FormatVariadic.h" // for format_provider -// Project includes -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t + +namespace lldb_private { +class Stream; +} +namespace llvm { +class raw_ostream; +} namespace lldb_private { //---------------------------------------------------------------------- -/// @class ConstString ConstString.h "lldb/Core/ConstString.h" +/// @class ConstString ConstString.h "lldb/Utility/ConstString.h" /// @brief A uniqued constant string class. /// /// Provides an efficient way to store strings as uniqued strings. After @@ -476,4 +480,11 @@ Stream &operator<<(Stream &s, const ConstString &str); } // namespace lldb_private +namespace llvm { +template <> struct format_provider<lldb_private::ConstString> { + static void format(const lldb_private::ConstString &CS, llvm::raw_ostream &OS, + llvm::StringRef Options); +}; +} + #endif // liblldb_ConstString_h_ diff --git a/include/lldb/Utility/ConvertEnum.h b/include/lldb/Utility/ConvertEnum.h deleted file mode 100644 index 239247d6a1da..000000000000 --- a/include/lldb/Utility/ConvertEnum.h +++ /dev/null @@ -1,21 +0,0 @@ -//===-- ConvertEnum.h -------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#ifndef LLDB_UTILITY_CONVERTENUM_H -#define LLDB_UTILITY_CONVERTENUM_H - -#include "lldb/lldb-enumerations.h" -#include "lldb/lldb-private-enumerations.h" - -namespace lldb_private { - -const char *GetVoteAsCString(Vote vote); -const char *GetSectionTypeAsCString(lldb::SectionType sect_type); -} - -#endif diff --git a/include/lldb/Core/DataBuffer.h b/include/lldb/Utility/DataBuffer.h index ffa71c06be80..ffa71c06be80 100644 --- a/include/lldb/Core/DataBuffer.h +++ b/include/lldb/Utility/DataBuffer.h diff --git a/include/lldb/Core/DataBufferHeap.h b/include/lldb/Utility/DataBufferHeap.h index 5528ebd9135f..20e27ef8950c 100644 --- a/include/lldb/Core/DataBufferHeap.h +++ b/include/lldb/Utility/DataBufferHeap.h @@ -10,10 +10,12 @@ #ifndef liblldb_DataBufferHeap_h_ #define liblldb_DataBufferHeap_h_ -#include <vector> +#include "lldb/Utility/DataBuffer.h" +#include "lldb/lldb-types.h" // for offset_t +#include "llvm/ADT/StringRef.h" // for StringRef -#include "lldb/Core/DataBuffer.h" -#include "lldb/lldb-private.h" +#include <cstdint> // for uint8_t, uint64_t +#include <vector> namespace lldb_private { @@ -25,7 +27,8 @@ namespace lldb_private { /// the object. This class is best used to store chunks of data that /// are created or read from sources that can't intelligently and lazily /// fault new data pages in. Large amounts of data that comes from files -/// should probably use the DataBufferMemoryMap class. +/// should probably use DataBufferLLVM, which can intelligently determine +/// when memory mapping is optimal. //---------------------------------------------------------------------- class DataBufferHeap : public DataBuffer { public: diff --git a/include/lldb/Utility/DataBufferLLVM.h b/include/lldb/Utility/DataBufferLLVM.h new file mode 100644 index 000000000000..737e2d019044 --- /dev/null +++ b/include/lldb/Utility/DataBufferLLVM.h @@ -0,0 +1,52 @@ +//===--- DataBufferLLVM.h ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_CORE_DATABUFFERLLVM_H +#define LLDB_CORE_DATABUFFERLLVM_H + +#include "lldb/Utility/DataBuffer.h" +#include "lldb/lldb-types.h" // for offset_t + +#include <memory> +#include <stdint.h> // for uint8_t, uint64_t + +namespace llvm { +class MemoryBuffer; +class Twine; +} + +namespace lldb_private { + +class DataBufferLLVM : public DataBuffer { +public: + ~DataBufferLLVM(); + + static std::shared_ptr<DataBufferLLVM> + CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset, bool Private = false); + + static std::shared_ptr<DataBufferLLVM> + CreateFromPath(const llvm::Twine &Path, bool NullTerminate = false, bool Private = false); + + uint8_t *GetBytes() override; + const uint8_t *GetBytes() const override; + lldb::offset_t GetByteSize() const override; + + char *GetChars() { return reinterpret_cast<char *>(GetBytes()); } + +private: + /// \brief Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a + /// valid pointer. + explicit DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> Buffer); + const uint8_t *GetBuffer() const; + + std::unique_ptr<llvm::MemoryBuffer> Buffer; +}; +} + +#endif diff --git a/include/lldb/Core/DataEncoder.h b/include/lldb/Utility/DataEncoder.h index a2bc4dcce330..ea347d86237b 100644 --- a/include/lldb/Core/DataEncoder.h +++ b/include/lldb/Utility/DataEncoder.h @@ -12,8 +12,12 @@ #if defined(__cplusplus) -#include "lldb/lldb-private.h" -#include <limits.h> +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ByteOrder +#include "lldb/lldb-forward.h" // for DataBufferSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t #include <stdint.h> namespace lldb_private { @@ -384,9 +388,9 @@ protected: lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from. uint8_t m_addr_size; ///< The address size to use when extracting pointers or - ///addresses + /// addresses mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can - ///be shared among multiple instances + /// be shared among multiple instances private: DISALLOW_COPY_AND_ASSIGN(DataEncoder); diff --git a/include/lldb/Core/DataExtractor.h b/include/lldb/Utility/DataExtractor.h index 89cc00548e46..58240d9a5268 100644 --- a/include/lldb/Core/DataExtractor.h +++ b/include/lldb/Utility/DataExtractor.h @@ -7,20 +7,28 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_DataExtractor_h_ -#define liblldb_DataExtractor_h_ +#ifndef LLDB_UTILITY_DATAEXTRACTOR_H +#define LLDB_UTILITY_DATAEXTRACTOR_H + +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder +#include "lldb/lldb-forward.h" // for DataBufferSP +#include "lldb/lldb-types.h" -// C Includes -#include <limits.h> #include <stdint.h> #include <string.h> -// C++ Includes -// Other libraries and framework includes -#include "llvm/ADT/SmallVector.h" +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Stream; +} +namespace llvm { +template <typename T> class SmallVectorImpl; +} -// Project includes -#include "lldb/lldb-private.h" +// C++ Includes namespace lldb_private { @@ -43,8 +51,6 @@ public: //------------------------------------------------------------------ /// @typedef DataExtractor::Type /// @brief Type enumerations used in the dump routines. - /// @see DataExtractor::Dump() - /// @see DataExtractor::DumpRawHexBytes() //------------------------------------------------------------------ typedef enum { TypeUInt8, ///< Format output as unsigned 8 bit integers @@ -57,12 +63,6 @@ public: TypeSLEB128 ///< Format output as SLEB128 numbers } Type; - static void DumpHexBytes(Stream *s, const void *src, size_t src_len, - uint32_t bytes_per_line, - lldb::addr_t base_addr); // Pass LLDB_INVALID_ADDRESS - // to not show address at - // start of line - //------------------------------------------------------------------ /// Default constructor. /// @@ -172,7 +172,9 @@ public: /// reference count on the data will be decremented, and if zero, /// the data will be freed. //------------------------------------------------------------------ - ~DataExtractor(); + virtual ~DataExtractor(); + + uint32_t getTargetByteSize() const { return m_target_byte_size; } //------------------------------------------------------------------ /// Clears the object state. @@ -225,73 +227,6 @@ public: const char *type_format = nullptr) const; //------------------------------------------------------------------ - /// Dumps \a item_count objects into the stream \a s. - /// - /// Dumps \a item_count objects using \a item_format, each of which - /// are \a item_byte_size bytes long starting at offset \a offset - /// bytes into the contained data, into the stream \a s. \a - /// num_per_line objects will be dumped on each line before a new - /// line will be output. If \a base_addr is a valid address, then - /// each new line of output will be preceded by the address value - /// plus appropriate offset, and a colon and space. Bitfield values - /// can be dumped by calling this function multiple times with the - /// same start offset, format and size, yet differing \a - /// item_bit_size and \a item_bit_offset values. - /// - /// @param[in] s - /// The stream to dump the output to. This value can not be nullptr. - /// - /// @param[in] offset - /// The offset into the data at which to start dumping. - /// - /// @param[in] item_format - /// The format to use when dumping each item. - /// - /// @param[in] item_byte_size - /// The byte size of each item. - /// - /// @param[in] item_count - /// The number of items to dump. - /// - /// @param[in] num_per_line - /// The number of items to display on each line. - /// - /// @param[in] base_addr - /// The base address that gets added to the offset displayed on - /// each line if the value is valid. Is \a base_addr is - /// LLDB_INVALID_ADDRESS then no address values will be prepended - /// to any lines. - /// - /// @param[in] item_bit_size - /// If the value to display is a bitfield, this value should - /// be the number of bits that the bitfield item has within the - /// item's byte size value. This function will need to be called - /// multiple times with identical \a offset and \a item_byte_size - /// values in order to display multiple bitfield values that - /// exist within the same integer value. If the items being - /// displayed are not bitfields, this value should be zero. - /// - /// @param[in] item_bit_offset - /// If the value to display is a bitfield, this value should - /// be the offset in bits, or shift right amount, that the - /// bitfield item occupies within the item's byte size value. - /// This function will need to be called multiple times with - /// identical \a offset and \a item_byte_size values in order - /// to display multiple bitfield values that exist within the - /// same integer value. If the items being displayed are not - /// bitfields, this value should be zero. - /// - /// @return - /// The offset at which dumping ended. - //------------------------------------------------------------------ - lldb::offset_t Dump(Stream *s, lldb::offset_t offset, - lldb::Format item_format, size_t item_byte_size, - size_t item_count, size_t num_per_line, - uint64_t base_addr, uint32_t item_bit_size, - uint32_t item_bit_offset, - ExecutionContextScope *exe_scope = nullptr) const; - - //------------------------------------------------------------------ /// Dump a UUID value at \a offset. /// /// Dump a UUID starting at \a offset bytes into this object's data. @@ -573,38 +508,6 @@ public: long double GetLongDouble(lldb::offset_t *offset_ptr) const; //------------------------------------------------------------------ - /// Extract a GNU encoded pointer value from \a *offset_ptr. - /// - /// @param[in,out] offset_ptr - /// A pointer to an offset within the data that will be advanced - /// by the appropriate number of bytes if the value is extracted - /// correctly. If the offset is out of bounds or there are not - /// enough bytes to extract this value, the offset will be left - /// unmodified. - /// - /// @param[in] eh_ptr_enc - /// The GNU pointer encoding type. - /// - /// @param[in] pc_rel_addr - /// The PC relative address to use when the encoding is - /// \c DW_GNU_EH_PE_pcrel. - /// - /// @param[in] text_addr - /// The text (code) relative address to use when the encoding is - /// \c DW_GNU_EH_PE_textrel. - /// - /// @param[in] data_addr - /// The data relative address to use when the encoding is - /// \c DW_GNU_EH_PE_datarel. - /// - /// @return - /// The extracted GNU encoded pointer value. - //------------------------------------------------------------------ - uint64_t GetGNUEHPointer(lldb::offset_t *offset_ptr, uint32_t eh_ptr_enc, - lldb::addr_t pc_rel_addr, lldb::addr_t text_addr, - lldb::addr_t data_addr); - - //------------------------------------------------------------------ /// Extract an integer of size \a byte_size from \a *offset_ptr. /// /// Extract a single integer value and update the offset pointed to @@ -1243,9 +1146,9 @@ protected: lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from. uint32_t m_addr_size; ///< The address size to use when extracting pointers or - ///addresses + /// addresses mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can - ///be shared among multiple instances + /// be shared among multiple instances const uint32_t m_target_byte_size; }; diff --git a/include/lldb/Host/Endian.h b/include/lldb/Utility/Endian.h index 82bc0b7749b1..2a102b63aa10 100644 --- a/include/lldb/Host/Endian.h +++ b/include/lldb/Utility/Endian.h @@ -7,11 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_host_endian_h_ -#define liblldb_host_endian_h_ +#ifndef LLDB_UTILITY_ENDIAN_H +#define LLDB_UTILITY_ENDIAN_H #include "lldb/lldb-enumerations.h" +#include <stdint.h> + namespace lldb_private { namespace endian { diff --git a/include/lldb/Core/Error.h b/include/lldb/Utility/Error.h index 8131580991ad..a236ab45a0bb 100644 --- a/include/lldb/Core/Error.h +++ b/include/lldb/Utility/Error.h @@ -11,23 +11,26 @@ #define __DCError_h__ #if defined(__cplusplus) -#include "llvm/Support/DataTypes.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" // for ErrorType, ErrorType... +#include "llvm/ADT/StringRef.h" // for StringRef #include "llvm/Support/FormatVariadic.h" #include <cstdarg> -#include <cstdio> #include <string> +#include <system_error> // for error_code +#include <type_traits> // for forward -#include "lldb/lldb-private.h" +#include <stdint.h> // for uint32_t -#include "llvm/Support/FormatVariadic.h" +namespace llvm { +class raw_ostream; +} namespace lldb_private { -class Log; - //---------------------------------------------------------------------- -/// @class Error Error.h "lldb/Core/Error.h" +/// @class Error Error.h "lldb/Utility/Error.h" /// @brief An error handling class. /// /// This class is designed to be able to hold any error code that can be @@ -69,6 +72,8 @@ public: explicit Error(ValueType err, lldb::ErrorType type = lldb::eErrorTypeGeneric); + /* implicit */ Error(std::error_code EC); + explicit Error(const char *format, ...) __attribute__((format(printf, 2, 3))); Error(const Error &rhs); @@ -148,48 +153,6 @@ public: lldb::ErrorType GetType() const; //------------------------------------------------------------------ - /// Log an error to Log(). - /// - /// Log the error given a formatted string \a format. If the this - /// object contains an error code, update the error string to - /// contain the prefix "error: ", followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. Logging always occurs - /// even when the error code contains a non-error value. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //------------------------------------------------------------------ - void PutToLog(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //------------------------------------------------------------------ - /// Log an error to Log() if the error value is an error. - /// - /// Log the error given a formatted string \a format only if the - /// error value in this object describes an error condition. If the - /// this object contains an error, update the error string to - /// contain the prefix "error: " followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //------------------------------------------------------------------ - void LogIfError(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //------------------------------------------------------------------ /// Set accessor from a kern_return_t. /// /// Set accesssor for the error value to \a err and the error type @@ -304,10 +267,7 @@ protected: namespace llvm { template <> struct format_provider<lldb_private::Error> { static void format(const lldb_private::Error &error, llvm::raw_ostream &OS, - llvm::StringRef Options) { - llvm::format_provider<llvm::StringRef>::format(error.AsCString(), OS, - Options); - } + llvm::StringRef Options); }; } diff --git a/include/lldb/Core/FastDemangle.h b/include/lldb/Utility/FastDemangle.h index f779aaa04606..f779aaa04606 100644 --- a/include/lldb/Core/FastDemangle.h +++ b/include/lldb/Utility/FastDemangle.h diff --git a/include/lldb/Host/FileSpec.h b/include/lldb/Utility/FileSpec.h index b8df7453886c..67926d01e529 100644 --- a/include/lldb/Host/FileSpec.h +++ b/include/lldb/Utility/FileSpec.h @@ -17,13 +17,28 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/STLUtils.h" -#include "lldb/Host/PosixApi.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/ConstString.h" +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormatVariadic.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class Stream; +} +namespace llvm { +class Triple; +} +namespace llvm { +class raw_ostream; +} +namespace llvm { +template <typename T> class SmallVectorImpl; +} + namespace lldb_private { //---------------------------------------------------------------------- @@ -46,17 +61,6 @@ namespace lldb_private { //---------------------------------------------------------------------- class FileSpec { public: - typedef enum FileType { - eFileTypeInvalid = -1, - eFileTypeUnknown = 0, - eFileTypeDirectory, - eFileTypePipe, - eFileTypeRegular, - eFileTypeSocket, - eFileTypeSymbolicLink, - eFileTypeOther - } FileType; - enum PathSyntax { ePathSyntaxPosix, ePathSyntaxWindows, @@ -85,7 +89,8 @@ public: explicit FileSpec(llvm::StringRef path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative); - explicit FileSpec(llvm::StringRef path, bool resolve_path, ArchSpec arch); + explicit FileSpec(llvm::StringRef path, bool resolve_path, + const llvm::Triple &Triple); //------------------------------------------------------------------ /// Copy constructor @@ -454,8 +459,6 @@ public: //------------------------------------------------------------------ ConstString GetFileNameStrippingExtension() const; - FileType GetFileType() const; - //------------------------------------------------------------------ /// Return the current permissions of the path. /// @@ -470,20 +473,6 @@ public: //------------------------------------------------------------------ uint32_t GetPermissions() const; - bool IsDirectory() const { - return GetFileType() == FileSpec::eFileTypeDirectory; - } - - bool IsPipe() const { return GetFileType() == FileSpec::eFileTypePipe; } - - bool IsRegularFile() const { - return GetFileType() == FileSpec::eFileTypeRegular; - } - - bool IsSocket() const { return GetFileType() == FileSpec::eFileTypeSocket; } - - bool IsSymbolicLink() const; - //------------------------------------------------------------------ /// Get the memory cost of this object. /// @@ -499,124 +488,6 @@ public: size_t MemorySize() const; //------------------------------------------------------------------ - /// Memory map part of, or the entire contents of, a file. - /// - /// Returns a shared pointer to a data buffer that contains all or - /// part of the contents of a file. The data is memory mapped and - /// will lazily page in data from the file as memory is accessed. - /// The data that is mapped will start \a offset bytes into the - /// file, and \a length bytes will be mapped. If \a length is - /// greater than the number of bytes available in the file starting - /// at \a offset, the number of bytes will be appropriately - /// truncated. The final number of bytes that get mapped can be - /// verified using the DataBuffer::GetByteSize() function on the return - /// shared data pointer object contents. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// A shared pointer to the memory mapped data. This shared - /// pointer can contain a nullptr DataBuffer pointer, so the contained - /// pointer must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP MemoryMapFileContents(off_t offset = 0, - size_t length = SIZE_MAX) const; - - //------------------------------------------------------------------ - /// Memory map part of, or the entire contents of, a file only if - /// the file is local (not on a network mount). - /// - /// Returns a shared pointer to a data buffer that contains all or - /// part of the contents of a file. The data will be memory mapped - /// if the file is local and will lazily page in data from the file - /// as memory is accessed. If the data is memory mapped, the data - /// that is mapped will start \a offset bytes into the file, and - /// \a length bytes will be mapped. If \a length is - /// greater than the number of bytes available in the file starting - /// at \a offset, the number of bytes will be appropriately - /// truncated. The final number of bytes that get mapped can be - /// verified using the DataBuffer::GetByteSize() function on the return - /// shared data pointer object contents. - /// - /// If the file is on a network mount the data will be read into a - /// heap buffer immediately so that accesses to the data won't later - /// cause a crash if we touch a page that isn't paged in and the - /// network mount has been disconnected or gone away. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// A shared pointer to the memory mapped data. This shared - /// pointer can contain a nullptr DataBuffer pointer, so the contained - /// pointer must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP MemoryMapFileContentsIfLocal(off_t file_offset, - size_t file_size) const; - - //------------------------------------------------------------------ - /// Read part of, or the entire contents of, a file into a heap based data - /// buffer. - /// - /// Returns a shared pointer to a data buffer that contains all or - /// part of the contents of a file. The data copies into a heap based - /// buffer that lives in the DataBuffer shared pointer object returned. - /// The data that is cached will start \a offset bytes into the - /// file, and \a length bytes will be mapped. If \a length is - /// greater than the number of bytes available in the file starting - /// at \a offset, the number of bytes will be appropriately - /// truncated. The final number of bytes that get mapped can be - /// verified using the DataBuffer::GetByteSize() function. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// A shared pointer to the memory mapped data. This shared - /// pointer can contain a nullptr DataBuffer pointer, so the contained - /// pointer must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP ReadFileContents(off_t offset = 0, - size_t length = SIZE_MAX, - Error *error_ptr = nullptr) const; - - size_t ReadFileContents(off_t file_offset, void *dst, size_t dst_len, - Error *error_ptr) const; - - //------------------------------------------------------------------ - /// Read the entire contents of a file as data that can be used - /// as a C string. - /// - /// Read the entire contents of a file and ensure that the data - /// is NULL terminated so it can be used as a C string. - /// - /// @return - /// A shared pointer to the data. This shared pointer can - /// contain a nullptr DataBuffer pointer, so the contained pointer - /// must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP ReadFileContentsAsCString(Error *error_ptr = nullptr); - - //------------------------------------------------------------------ /// Normalize a pathname by collapsing redundant separators and /// up-level references. //------------------------------------------------------------------ @@ -639,7 +510,8 @@ public: void SetFile(llvm::StringRef path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative); - void SetFile(llvm::StringRef path, bool resolve_path, ArchSpec arch); + void SetFile(llvm::StringRef path, bool resolve_path, + const llvm::Triple &Triple); bool IsResolved() const { return m_is_resolved; } @@ -659,21 +531,6 @@ public: void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; } //------------------------------------------------------------------ - /// Read the file into an array of strings, one per line. - /// - /// Opens and reads the file in this object into an array of strings, - /// one string per line of the file. Returns a boolean indicating - /// success or failure. - /// - /// @param[out] lines - /// The string array into which to read the file. - /// - /// @result - /// Returns the number of lines that were read from the file. - //------------------------------------------------------------------ - size_t ReadFileLines(STLStringArray &lines); - - //------------------------------------------------------------------ /// Resolves user name and links in \a path, and overwrites the input /// argument with the resolved path. /// @@ -696,53 +553,27 @@ public: ConstString GetLastPathComponent() const; - //------------------------------------------------------------------ - /// Resolves the user name at the beginning of \a src_path, and writes the - /// output - /// to \a dst_path. Note, \a src_path can contain other path components after - /// the - /// user name, they will be copied over, and if the path doesn't start with - /// "~" it - /// will also be copied over to \a dst_path. - /// - /// @param[in] src_path - /// Input path to be resolved. - /// - /// @param[in] dst_path - /// Buffer to store the resolved path. - //------------------------------------------------------------------ - static void ResolveUsername(llvm::SmallVectorImpl<char> &path); - - static size_t ResolvePartialUsername(llvm::StringRef partial_name, - StringList &matches); - enum EnumerateDirectoryResult { eEnumerateDirectoryResultNext, // Enumerate next entry in the current // directory eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a // directory or symlink, or next if not - eEnumerateDirectoryResultExit, // Exit from the current directory at the - // current level. eEnumerateDirectoryResultQuit // Stop directory enumerations at any level }; typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)( - void *baton, FileType file_type, const FileSpec &spec); + void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec); - static EnumerateDirectoryResult - EnumerateDirectory(llvm::StringRef dir_path, bool find_directories, - bool find_files, bool find_other, - EnumerateDirectoryCallbackType callback, - void *callback_baton); + static void EnumerateDirectory(llvm::StringRef dir_path, + bool find_directories, bool find_files, + bool find_other, + EnumerateDirectoryCallbackType callback, + void *callback_baton); - typedef std::function<EnumerateDirectoryResult(FileType file_type, - const FileSpec &spec)> + typedef std::function<EnumerateDirectoryResult( + llvm::sys::fs::file_type file_type, const FileSpec &spec)> DirectoryCallback; - static EnumerateDirectoryResult - ForEachItemInDirectory(llvm::StringRef dir_path, - DirectoryCallback const &callback); - protected: //------------------------------------------------------------------ // Member variables diff --git a/include/lldb/Core/Flags.h b/include/lldb/Utility/Flags.h index d1bf685bced7..1b303858b1c1 100644 --- a/include/lldb/Core/Flags.h +++ b/include/lldb/Utility/Flags.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Flags_h_ -#define liblldb_Flags_h_ +#ifndef LLDB_UTILITY_FLAGS_H +#define LLDB_UTILITY_FLAGS_H #include <cstddef> #include <cstdint> @@ -16,7 +16,7 @@ namespace lldb_private { //---------------------------------------------------------------------- -/// @class Flags Flags.h "lldb/Core/Flags.h" +/// @class Flags Flags.h "lldb/Utility/Flags.h" /// @brief A class to manage flags. /// /// The Flags class managed flag bits and allows testing and diff --git a/include/lldb/Core/History.h b/include/lldb/Utility/History.h index fcffcdd901bb..c6882b65fd8e 100644 --- a/include/lldb/Core/History.h +++ b/include/lldb/Utility/History.h @@ -10,17 +10,19 @@ #ifndef lldb_History_h_ #define lldb_History_h_ -// C Includes -#include <stdint.h> +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN // C++ Includes #include <mutex> #include <stack> #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-public.h" +#include <stddef.h> // for size_t +#include <stdint.h> + +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Utility/JSON.h b/include/lldb/Utility/JSON.h index 145ef4868d2f..5c5d382048c1 100644 --- a/include/lldb/Utility/JSON.h +++ b/include/lldb/Utility/JSON.h @@ -10,19 +10,20 @@ #ifndef utility_JSON_h_ #define utility_JSON_h_ -#include "lldb/Core/Stream.h" #include "lldb/Utility/StringExtractor.h" -#include <inttypes.h> #include <map> #include <memory> -#include <stdint.h> #include <string> +#include <type_traits> #include <vector> -#include "llvm/Support/Casting.h" +#include <stdint.h> namespace lldb_private { +class Stream; +} +namespace lldb_private { class JSONValue { public: diff --git a/include/lldb/Utility/LLDBAssert.h b/include/lldb/Utility/LLDBAssert.h index 328a4d4f9258..9d9f3ceefab0 100644 --- a/include/lldb/Utility/LLDBAssert.h +++ b/include/lldb/Utility/LLDBAssert.h @@ -1,5 +1,4 @@ -//===----------------- LLDBAssert.h --------------------------------*- C++ -//-*-===// +//===----------------- LLDBAssert.h ------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,8 +10,6 @@ #ifndef utility_LLDBAssert_h_ #define utility_LLDBAssert_h_ -#include <assert.h> - #ifdef LLDB_CONFIGURATION_DEBUG #define lldbassert(x) assert(x) #else diff --git a/include/lldb/Utility/Log.h b/include/lldb/Utility/Log.h new file mode 100644 index 000000000000..bfc0f4c9590a --- /dev/null +++ b/include/lldb/Utility/Log.h @@ -0,0 +1,218 @@ +//===-- Log.h ---------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_UTILITY_LOG_H +#define LLDB_UTILITY_LOG_H + +#include "lldb/Utility/Flags.h" +#include "lldb/Utility/Logging.h" +#include "lldb/lldb-defines.h" + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringMap.h" // for StringMap +#include "llvm/ADT/StringRef.h" // for StringRef, StringLiteral +#include "llvm/Support/FormatVariadic.h" +#include "llvm/Support/RWMutex.h" + +#include <atomic> +#include <cstdarg> +#include <cstdint> +#include <memory> // for shared_ptr +#include <string> // for string +#include <type_traits> // for forward + +namespace llvm { +class raw_ostream; +} +namespace llvm { +template <class C> class ManagedStatic; +} +//---------------------------------------------------------------------- +// Logging Options +//---------------------------------------------------------------------- +#define LLDB_LOG_OPTION_THREADSAFE (1u << 0) +#define LLDB_LOG_OPTION_VERBOSE (1u << 1) +#define LLDB_LOG_OPTION_PREPEND_SEQUENCE (1u << 3) +#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP (1u << 4) +#define LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD (1u << 5) +#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME (1U << 6) +#define LLDB_LOG_OPTION_BACKTRACE (1U << 7) +#define LLDB_LOG_OPTION_APPEND (1U << 8) +#define LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION (1U << 9) + +//---------------------------------------------------------------------- +// Logging Functions +//---------------------------------------------------------------------- +namespace lldb_private { + +class Log final { +public: + // Description of a log channel category. + struct Category { + llvm::StringLiteral name; + llvm::StringLiteral description; + uint32_t flag; + }; + + // This class describes a log channel. It also encapsulates the behavior + // necessary to enable a log channel in an atomic manner. + class Channel { + std::atomic<Log *> log_ptr; + friend class Log; + + public: + const llvm::ArrayRef<Category> categories; + const uint32_t default_flags; + + constexpr Channel(llvm::ArrayRef<Log::Category> categories, + uint32_t default_flags) + : log_ptr(nullptr), categories(categories), + default_flags(default_flags) {} + + // This function is safe to call at any time + // If the channel is disabled after (or concurrently with) this function + // returning a non-null Log pointer, it is still safe to attempt to write to + // the Log object -- the output will be discarded. + Log *GetLogIfAll(uint32_t mask) { + Log *log = log_ptr.load(std::memory_order_relaxed); + if (log && log->GetMask().AllSet(mask)) + return log; + return nullptr; + } + + // This function is safe to call at any time + // If the channel is disabled after (or concurrently with) this function + // returning a non-null Log pointer, it is still safe to attempt to write to + // the Log object -- the output will be discarded. + Log *GetLogIfAny(uint32_t mask) { + Log *log = log_ptr.load(std::memory_order_relaxed); + if (log && log->GetMask().AnySet(mask)) + return log; + return nullptr; + } + }; + + //------------------------------------------------------------------ + // Static accessors for logging channels + //------------------------------------------------------------------ + static void Register(llvm::StringRef name, Channel &channel); + static void Unregister(llvm::StringRef name); + + static bool + EnableLogChannel(const std::shared_ptr<llvm::raw_ostream> &log_stream_sp, + uint32_t log_options, llvm::StringRef channel, + llvm::ArrayRef<const char *> categories, + llvm::raw_ostream &error_stream); + + static bool DisableLogChannel(llvm::StringRef channel, + llvm::ArrayRef<const char *> categories, + llvm::raw_ostream &error_stream); + + static bool ListChannelCategories(llvm::StringRef channel, llvm::raw_ostream &stream); + + static void DisableAllLogChannels(); + + static void ListAllLogChannels(llvm::raw_ostream &stream); + + //------------------------------------------------------------------ + // Member functions + // + // These functions are safe to call at any time you have a Log* obtained from + // the Channel class. If logging is disabled between you obtaining the Log + // object and writing to it, the output will be silently discarded. + //------------------------------------------------------------------ + Log(Channel &channel) : m_channel(channel) {} + ~Log() = default; + + void PutCString(const char *cstr); + void PutString(llvm::StringRef str); + + template <typename... Args> + void Format(llvm::StringRef file, llvm::StringRef function, + const char *format, Args &&... args) { + Format(file, function, llvm::formatv(format, std::forward<Args>(args)...)); + } + + void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); + + void VAPrintf(const char *format, va_list args); + + void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3))); + + void VAError(const char *format, va_list args); + + void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3))); + + void Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3))); + + const Flags GetOptions() const; + + const Flags GetMask() const; + + bool GetVerbose() const; + +private: + Channel &m_channel; + + // The mutex makes sure enable/disable operations are thread-safe. The options + // and mask variables are atomic to enable their reading in + // Channel::GetLogIfAny without taking the mutex to speed up the fast path. + // Their modification however, is still protected by this mutex. + llvm::sys::RWMutex m_mutex; + + std::shared_ptr<llvm::raw_ostream> m_stream_sp; + std::atomic<uint32_t> m_options{0}; + std::atomic<uint32_t> m_mask{0}; + + void WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file, + llvm::StringRef function); + void WriteMessage(const std::string &message); + + void Format(llvm::StringRef file, llvm::StringRef function, + const llvm::formatv_object_base &payload); + + std::shared_ptr<llvm::raw_ostream> GetStream() { + llvm::sys::ScopedReader lock(m_mutex); + return m_stream_sp; + } + + void Enable(const std::shared_ptr<llvm::raw_ostream> &stream_sp, + uint32_t options, uint32_t flags); + + void Disable(uint32_t flags); + + typedef llvm::StringMap<Log> ChannelMap; + static llvm::ManagedStatic<ChannelMap> g_channel_map; + + static void ListCategories(llvm::raw_ostream &stream, + const ChannelMap::value_type &entry); + static uint32_t GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry, + llvm::ArrayRef<const char *> categories); + + Log(const Log &) = delete; + void operator=(const Log &) = delete; +}; + +} // namespace lldb_private + +#define LLDB_LOG(log, ...) \ + do { \ + ::lldb_private::Log *log_private = (log); \ + if (log_private) \ + log_private->Format(__FILE__, __FUNCTION__, __VA_ARGS__); \ + } while (0) + +#define LLDB_LOGV(log, ...) \ + do { \ + ::lldb_private::Log *log_private = (log); \ + if (log_private && log_private->GetVerbose()) \ + log_private->Format(__FILE__, __FUNCTION__, __VA_ARGS__); \ + } while (0) + +#endif // LLDB_UTILITY_LOG_H diff --git a/include/lldb/Core/Logging.h b/include/lldb/Utility/Logging.h index d93fa05af125..865097e7c194 100644 --- a/include/lldb/Core/Logging.h +++ b/include/lldb/Utility/Logging.h @@ -7,19 +7,14 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Core_Logging_h_ -#define liblldb_Core_Logging_h_ +#ifndef LLDB_UTILITY_LOGGING_H +#define LLDB_UTILITY_LOGGING_H -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" +#include <cstdint> //---------------------------------------------------------------------- // Log Bits specific to logging in lldb //---------------------------------------------------------------------- -#define LIBLLDB_LOG_VERBOSE (1u << 0) #define LIBLLDB_LOG_PROCESS (1u << 1) #define LIBLLDB_LOG_THREAD (1u << 2) #define LIBLLDB_LOG_DYNAMIC_LOADER (1u << 3) @@ -59,7 +54,7 @@ namespace lldb_private { -void LogIfAllCategoriesSet(uint32_t mask, const char *format, ...); +class Log; void LogIfAnyCategoriesSet(uint32_t mask, const char *format, ...); @@ -67,17 +62,8 @@ Log *GetLogIfAllCategoriesSet(uint32_t mask); Log *GetLogIfAnyCategoriesSet(uint32_t mask); -uint32_t GetLogMask(); - -bool IsLogVerbose(); - -void DisableLog(const char **categories, Stream *feedback_strm); - -Log *EnableLog(lldb::StreamSP &log_stream_sp, uint32_t log_options, - const char **categories, Stream *feedback_strm); - -void ListLogCategories(Stream *strm); +void InitializeLog(); } // namespace lldb_private -#endif // liblldb_Core_Logging_h_ +#endif // LLDB_UTILITY_LOGGING_H diff --git a/include/lldb/Utility/NameMatches.h b/include/lldb/Utility/NameMatches.h index 50ea7ba7f887..bc9ec703770a 100644 --- a/include/lldb/Utility/NameMatches.h +++ b/include/lldb/Utility/NameMatches.h @@ -9,12 +9,20 @@ #ifndef LLDB_UTILITY_NAMEMATCHES_H #define LLDB_UTILITY_NAMEMATCHES_H -#include "lldb/lldb-private-enumerations.h" - #include "llvm/ADT/StringRef.h" namespace lldb_private { -bool NameMatches(llvm::StringRef name, NameMatchType match_type, + +enum class NameMatch { + Ignore, + Equals, + Contains, + StartsWith, + EndsWith, + RegularExpression +}; + +bool NameMatches(llvm::StringRef name, NameMatch match_type, llvm::StringRef match); } diff --git a/include/lldb/Utility/PriorityPointerPair.h b/include/lldb/Utility/PriorityPointerPair.h deleted file mode 100644 index 2bd369e78a9a..000000000000 --- a/include/lldb/Utility/PriorityPointerPair.h +++ /dev/null @@ -1,86 +0,0 @@ -//===-- PriorityPointerPair.h ----------------------------------------*- C++ -//-*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_PriorityPointerPair_h_ -#define liblldb_PriorityPointerPair_h_ - -#include "lldb/Utility/SharingPtr.h" -#include "lldb/lldb-public.h" - -namespace lldb_utility { - -//---------------------------------------------------------------------- -// A prioritized pair of SharedPtr<T>. One of the two pointers is high -// priority, the other is low priority. -// The Get() method always returns high, if *high != NULL, -// otherwise, low is returned (even if *low == NULL) -//---------------------------------------------------------------------- - -template <typename T> class PriorityPointerPair { -public: - typedef T &reference_type; - typedef T *pointer_type; - - typedef typename std::shared_ptr<T> T_SP; - - PriorityPointerPair() : m_high(), m_low() {} - - PriorityPointerPair(pointer_type high, pointer_type low) - : m_high(high), m_low(low) {} - - PriorityPointerPair(pointer_type low) : m_high(), m_low(low) {} - - PriorityPointerPair(T_SP &high, T_SP &low) : m_high(high), m_low(low) {} - - PriorityPointerPair(T_SP &low) : m_high(), m_low(low) {} - - void SwapLow(pointer_type l) { m_low.swap(l); } - - void SwapHigh(pointer_type h) { m_high.swap(h); } - - void SwapLow(T_SP l) { m_low.swap(l); } - - void SwapHigh(T_SP h) { m_high.swap(h); } - - T_SP GetLow() { return m_low; } - - T_SP GetHigh() { return m_high; } - - T_SP Get() { - if (m_high.get()) - return m_high; - return m_low; - } - - void ResetHigh() { m_high.reset(); } - - void ResetLow() { m_low.reset(); } - - void Reset() { - ResetLow(); - ResetHigh(); - } - - reference_type operator*() const { return Get().operator*(); } - - pointer_type operator->() const { return Get().operator->(); } - - ~PriorityPointerPair(); - -private: - T_SP m_high; - T_SP m_low; - - DISALLOW_COPY_AND_ASSIGN(PriorityPointerPair); -}; - -} // namespace lldb_utility - -#endif // #ifndef liblldb_PriorityPointerPair_h_ diff --git a/include/lldb/Utility/Range.h b/include/lldb/Utility/Range.h index c13bc0d08bd6..60880dbdbc87 100644 --- a/include/lldb/Utility/Range.h +++ b/include/lldb/Utility/Range.h @@ -10,7 +10,6 @@ #ifndef utility_Range_h_ #define utility_Range_h_ -#include <algorithm> #include <stdint.h> namespace lldb_utility { diff --git a/include/lldb/Core/RegularExpression.h b/include/lldb/Utility/RegularExpression.h index fe34ef545dc4..d97e35647583 100644 --- a/include/lldb/Core/RegularExpression.h +++ b/include/lldb/Utility/RegularExpression.h @@ -36,11 +36,13 @@ inline void regfree(llvm_regex_t *a) { llvm_regfree(a); } #endif #include <regex.h> #endif -#include <stdint.h> #include <string> #include <vector> +#include <stddef.h> // for size_t +#include <stdint.h> + namespace llvm { class StringRef; } // namespace llvm @@ -48,7 +50,8 @@ class StringRef; namespace lldb_private { //---------------------------------------------------------------------- -/// @class RegularExpression RegularExpression.h "lldb/Core/RegularExpression.h" +/// @class RegularExpression RegularExpression.h +/// "lldb/Utility/RegularExpression.h" /// @brief A C++ wrapper class for regex. /// /// This regular expression class wraps the posix regex functions diff --git a/include/lldb/Utility/SelectHelper.h b/include/lldb/Utility/SelectHelper.h index 0251c8e72cde..5fa856b15d9f 100644 --- a/include/lldb/Utility/SelectHelper.h +++ b/include/lldb/Utility/SelectHelper.h @@ -10,16 +10,13 @@ #ifndef liblldb_SelectHelper_h_ #define liblldb_SelectHelper_h_ -// C Includes -// C++ Includes -#include <chrono> +#include "lldb/Utility/Error.h" // for Error +#include "lldb/lldb-types.h" // for socket_t -// Other libraries and framework includes #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Optional.h" -// Project includes -#include "lldb/lldb-forward.h" +#include <chrono> class SelectHelper { public: diff --git a/include/lldb/Utility/SharingPtr.h b/include/lldb/Utility/SharingPtr.h index 4e91222b3c31..49b0020da3ef 100644 --- a/include/lldb/Utility/SharingPtr.h +++ b/include/lldb/Utility/SharingPtr.h @@ -12,7 +12,6 @@ // C Includes // C++ Includes -#include <algorithm> #include <memory> // Microsoft Visual C++ currently does not enable std::atomic to work @@ -24,6 +23,8 @@ #include <atomic> #endif +#include <stddef.h> + // Other libraries and framework includes // Project includes diff --git a/include/lldb/Core/Stream.h b/include/lldb/Utility/Stream.h index 1bea3e179223..5a00f0a50ca3 100644 --- a/include/lldb/Core/Stream.h +++ b/include/lldb/Utility/Stream.h @@ -10,21 +10,21 @@ #ifndef liblldb_Stream_h_ #define liblldb_Stream_h_ -// C Includes -#include <stdarg.h> - -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Flags.h" -#include "lldb/lldb-private.h" - +#include "lldb/Utility/Flags.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder::eByteOrderInvalid +#include "llvm/ADT/StringRef.h" // for StringRef #include "llvm/Support/FormatVariadic.h" +#include <stdarg.h> +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, uint8_t +#include <type_traits> // for forward + namespace lldb_private { //---------------------------------------------------------------------- -/// @class Stream Stream.h "lldb/Core/Stream.h" +/// @class Stream Stream.h "lldb/Utility/Stream.h" /// @brief A stream class that can stream formatted output to a file. //---------------------------------------------------------------------- class Stream { @@ -33,12 +33,8 @@ public: /// \a m_flags bit values. //------------------------------------------------------------------ enum { - eVerbose = (1 << 0), ///< If set, verbose logging is enabled - eDebug = (1 << 1), ///< If set, debug logging is enabled - eAddPrefix = (1 << 2), ///< Add number prefixes for binary, octal and hex - ///when eBinary is clear - eBinary = (1 << 3) ///< Get and put data as binary instead of as the default - ///string mode. + eBinary = (1 << 0) ///< Get and put data as binary instead of as the default + /// string mode. }; //------------------------------------------------------------------ @@ -385,15 +381,6 @@ public: uint32_t GetAddressByteSize() const; //------------------------------------------------------------------ - /// Test if debug logging is enabled. - /// - /// @return - // \b true if the debug flag bit is set in this stream, \b - // false otherwise. - //------------------------------------------------------------------ - bool GetDebug() const; - - //------------------------------------------------------------------ /// The flags accessor. /// /// @return @@ -426,15 +413,6 @@ public: int GetIndentLevel() const; //------------------------------------------------------------------ - /// Test if verbose logging is enabled. - /// - /// @return - // \b true if the verbose flag bit is set in this stream, \b - // false otherwise. - //------------------------------------------------------------------ - bool GetVerbose() const; - - //------------------------------------------------------------------ /// Indent the current line in the stream. /// /// Indent the current line using the current indentation level and diff --git a/include/lldb/Core/StreamCallback.h b/include/lldb/Utility/StreamCallback.h index 4dc72c8c54c8..0aa9d5d57b2f 100644 --- a/include/lldb/Core/StreamCallback.h +++ b/include/lldb/Utility/StreamCallback.h @@ -10,32 +10,25 @@ #ifndef liblldb_StreamCallback_h_ #define liblldb_StreamCallback_h_ -#include <mutex> -#include <string> +#include "lldb/lldb-types.h" +#include "llvm/Support/raw_ostream.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint64_t namespace lldb_private { -class StreamCallback : public Stream { +class StreamCallback : public llvm::raw_ostream { public: StreamCallback(lldb::LogOutputCallback callback, void *baton); - - ~StreamCallback() override; - - void Flush() override; - - size_t Write(const void *src, size_t src_len) override; + ~StreamCallback() override = default; private: - typedef std::map<lldb::tid_t, StreamString> collection; lldb::LogOutputCallback m_callback; void *m_baton; - collection m_accumulated_data; - std::mutex m_collection_mutex; - StreamString &FindStreamForThread(lldb::tid_t cur_tid); + void write_impl(const char *Ptr, size_t Size) override; + uint64_t current_pos() const override; }; } // namespace lldb_private diff --git a/include/lldb/Core/StreamGDBRemote.h b/include/lldb/Utility/StreamGDBRemote.h index 150b3012cd0d..79234cc03d86 100644 --- a/include/lldb/Core/StreamGDBRemote.h +++ b/include/lldb/Utility/StreamGDBRemote.h @@ -1,5 +1,4 @@ -//===-- StreamGDBRemote.h ----------------------------------------*- C++ -//-*-===// +//===-- StreamGDBRemote.h ----------------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,13 +10,11 @@ #ifndef liblldb_StreamGDBRemote_h_ #define liblldb_StreamGDBRemote_h_ -// C Includes -// C++ Includes +#include "lldb/Utility/StreamString.h" // for StreamString +#include "lldb/lldb-enumerations.h" // for ByteOrder -// Other libraries and framework includes -// Project includes - -#include "lldb/Core/StreamString.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t namespace lldb_private { diff --git a/include/lldb/Core/StreamString.h b/include/lldb/Utility/StreamString.h index 88501a1bf611..0ae3e82a3498 100644 --- a/include/lldb/Core/StreamString.h +++ b/include/lldb/Utility/StreamString.h @@ -10,9 +10,14 @@ #ifndef liblldb_StreamString_h_ #define liblldb_StreamString_h_ -#include <string> +#include "lldb/Utility/Stream.h" // for Stream +#include "lldb/lldb-enumerations.h" // for ByteOrder +#include "llvm/ADT/StringRef.h" // for StringRef -#include "lldb/Core/Stream.h" +#include <string> // for string + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t namespace lldb_private { diff --git a/include/lldb/Core/StreamTee.h b/include/lldb/Utility/StreamTee.h index 48f92c839481..676178a0fe75 100644 --- a/include/lldb/Core/StreamTee.h +++ b/include/lldb/Utility/StreamTee.h @@ -14,7 +14,7 @@ #include <mutex> -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" namespace lldb_private { diff --git a/include/lldb/Utility/StringExtractor.h b/include/lldb/Utility/StringExtractor.h index 624d1ef3edfd..40c1ef79cffb 100644 --- a/include/lldb/Utility/StringExtractor.h +++ b/include/lldb/Utility/StringExtractor.h @@ -10,16 +10,15 @@ #ifndef utility_StringExtractor_h_ #define utility_StringExtractor_h_ -// C Includes -// C++ Includes -#include <stdint.h> -#include <string> - // Other libraries and framework includes // Project includes #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" +#include <stddef.h> // for size_t +#include <stdint.h> +#include <string> + class StringExtractor { public: enum { BigEndian = 0, LittleEndian = 1 }; diff --git a/include/lldb/Utility/StringLexer.h b/include/lldb/Utility/StringLexer.h index 3a399dfd7812..e2c31db329cc 100644 --- a/include/lldb/Utility/StringLexer.h +++ b/include/lldb/Utility/StringLexer.h @@ -11,9 +11,9 @@ #ifndef utility_StringLexer_h_ #define utility_StringLexer_h_ -#include <initializer_list> -#include <list> -#include <string> +#include <initializer_list> // for initializer_list +#include <string> // for string +#include <utility> // for pair namespace lldb_utility { diff --git a/include/lldb/Core/StringList.h b/include/lldb/Utility/StringList.h index 2cd974dea947..2be9a6bd8346 100644 --- a/include/lldb/Core/StringList.h +++ b/include/lldb/Utility/StringList.h @@ -10,18 +10,18 @@ #ifndef liblldb_StringList_h_ #define liblldb_StringList_h_ -// C Includes -#include <stdint.h> +#include "llvm/ADT/StringRef.h" -// C++ Includes +#include <stddef.h> // for size_t #include <string> +#include <vector> -// Other libraries and framework includes -#include "llvm/ADT/StringRef.h" - -// Project includes -#include "lldb/Core/STLUtils.h" -#include "lldb/lldb-forward.h" +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { @@ -49,8 +49,6 @@ public: void AppendList(StringList strings); - bool ReadFileLines(FileSpec &input_file); - size_t GetSize() const; void SetSize(size_t n) { m_strings.resize(n); } @@ -133,7 +131,7 @@ public: } private: - STLStringArray m_strings; + std::vector<std::string> m_strings; }; } // namespace lldb_private diff --git a/include/lldb/Utility/TaskPool.h b/include/lldb/Utility/TaskPool.h index db15b208171b..fb936bbb739a 100644 --- a/include/lldb/Utility/TaskPool.h +++ b/include/lldb/Utility/TaskPool.h @@ -10,29 +10,12 @@ #ifndef utility_TaskPool_h_ #define utility_TaskPool_h_ -#if defined(__cplusplus) && defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0) -// Compiling MSVC libraries with _HAS_EXCEPTIONS=0, eliminates most but not all -// calls to __uncaught_exception. Unfortunately, it does seem to eliminate -// the delcaration of __uncaught_excpeiton. Including <eh.h> ensures that it is -// declared. This may not be necessary after MSVC 12. -#include <eh.h> -#endif - -#if defined(_MSC_VER) -// Due to another bug in MSVC 2013, including <future> will generate hundreds of -// warnings in the Concurrency Runtime. This can be removed when we switch to -// MSVC 2015 -#pragma warning(push) -#pragma warning(disable : 4062) -#endif - -#include <cassert> -#include <cstdint> +#include <functional> // for bind, function #include <future> #include <list> -#include <queue> -#include <thread> -#include <vector> +#include <memory> // for make_shared +#include <mutex> // for mutex, unique_lock, condition_variable +#include <type_traits> // for forward, result_of, move // Global TaskPool class for running tasks in parallel on a set of worker thread // created the first @@ -203,8 +186,4 @@ template <typename T> void TaskRunner<T>::WaitForAllTasks() { ; } -#if defined(_MSC_VER) -#pragma warning(pop) -#endif - #endif // #ifndef utility_TaskPool_h_ diff --git a/include/lldb/Utility/TildeExpressionResolver.h b/include/lldb/Utility/TildeExpressionResolver.h new file mode 100644 index 000000000000..84620320c7ac --- /dev/null +++ b/include/lldb/Utility/TildeExpressionResolver.h @@ -0,0 +1,65 @@ +//===--------------------- TildeExpressionResolver.h ------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H +#define LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H + +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/StringSet.h" + +namespace llvm { +template <typename T> class SmallVectorImpl; +} + +namespace lldb_private { +class TildeExpressionResolver { +public: + virtual ~TildeExpressionResolver(); + + /// \brief Resolve a Tilde Expression contained according to bash rules. + /// + /// \param Expr Contains the tilde expression to resolve. A valid tilde + /// expression must begin with a tilde and contain only non + /// separator characters. + /// + /// \param Output Contains the resolved tilde expression, or the original + /// input if the tilde expression could not be resolved. + /// + /// \returns true if \p Expr was successfully resolved, false otherwise. + virtual bool ResolveExact(llvm::StringRef Expr, + llvm::SmallVectorImpl<char> &Output) = 0; + + /// \brief Auto-complete a tilde expression with all matching values. + /// + /// \param Expr Contains the tilde expression prefix to resolve. See + /// ResolveExact() for validity rules. + /// + /// \param Output Contains all matching home directories, each one + /// itself unresolved (i.e. you need to call ResolveExact + /// on each item to turn it into a real path). + /// + /// \returns true if there were any matches, false otherwise. + virtual bool ResolvePartial(llvm::StringRef Expr, + llvm::StringSet<> &Output) = 0; + + /// \brief Resolve an entire path that begins with a tilde expression, + /// replacing the username portion with the matched result. + bool ResolveFullPath(llvm::StringRef Expr, + llvm::SmallVectorImpl<char> &Output); +}; + +class StandardTildeExpressionResolver : public TildeExpressionResolver { +public: + bool ResolveExact(llvm::StringRef Expr, + llvm::SmallVectorImpl<char> &Output) override; + bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override; +}; +} + +#endif // #ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H diff --git a/include/lldb/Utility/Timeout.h b/include/lldb/Utility/Timeout.h index 6c6fd009acb0..7b627a45fc63 100644 --- a/include/lldb/Utility/Timeout.h +++ b/include/lldb/Utility/Timeout.h @@ -11,7 +11,8 @@ #define liblldb_Timeout_h_ #include "llvm/ADT/Optional.h" -#include <chrono> +#include "llvm/Support/Chrono.h" +#include "llvm/Support/FormatProviders.h" namespace lldb_private { @@ -52,4 +53,19 @@ public: } // namespace lldb_private +namespace llvm { +template<typename Ratio> +struct format_provider<lldb_private::Timeout<Ratio>, void> { + static void format(const lldb_private::Timeout<Ratio> &timeout, + raw_ostream &OS, StringRef Options) { + typedef typename lldb_private::Timeout<Ratio>::value_type Dur; + + if (!timeout) + OS << "<infinite>"; + else + format_provider<Dur>::format(*timeout, OS, Options); + } +}; +} + #endif // liblldb_Timeout_h_ diff --git a/include/lldb/Core/UUID.h b/include/lldb/Utility/UUID.h index 7cf5cf389400..28069bbe4c73 100644 --- a/include/lldb/Core/UUID.h +++ b/include/lldb/Utility/UUID.h @@ -7,19 +7,23 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_UUID_h_ -#define liblldb_UUID_h_ +#ifndef LLDB_UTILITY_UUID_H +#define LLDB_UTILITY_UUID_H // C Includes // C++ Includes +#include <stddef.h> +#include <stdint.h> #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" +namespace llvm { + class StringRef; +} namespace lldb_private { + class Stream; + class UUID { public: // Most UUIDs are 16 bytes, but some Linux build-ids (SHA1) are 20. @@ -93,4 +97,4 @@ bool operator>=(const UUID &lhs, const UUID &rhs); } // namespace lldb_private -#endif // liblldb_UUID_h_ +#endif // LLDB_UTILITY_UUID_H diff --git a/include/lldb/Utility/UriParser.h b/include/lldb/Utility/UriParser.h new file mode 100644 index 000000000000..db0049d9684c --- /dev/null +++ b/include/lldb/Utility/UriParser.h @@ -0,0 +1,32 @@ +//===-- UriParser.h ---------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef utility_UriParser_h_ +#define utility_UriParser_h_ + +#include "llvm/ADT/StringRef.h" + +namespace lldb_private { +class UriParser { +public: + // Parses + // RETURN VALUE + // if url is valid, function returns true and + // scheme/hostname/port/path are set to the parsed values + // port it set to -1 if it is not included in the URL + // + // if the url is invalid, function returns false and + // output parameters remain unchanged + static bool Parse(llvm::StringRef uri, llvm::StringRef &scheme, + llvm::StringRef &hostname, int &port, + llvm::StringRef &path); +}; +} + +#endif // utility_UriParser_h_ diff --git a/include/lldb/Core/UserID.h b/include/lldb/Utility/UserID.h index 596448334555..b178efd44fe4 100644 --- a/include/lldb/Core/UserID.h +++ b/include/lldb/Utility/UserID.h @@ -10,7 +10,11 @@ #ifndef liblldb_UserID_h_ #define liblldb_UserID_h_ -#include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" // for LLDB_INVALID_UID +#include "lldb/lldb-types.h" // for user_id_t +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/include/lldb/Utility/Utils.h b/include/lldb/Utility/Utils.h deleted file mode 100644 index 46bc1847c0b7..000000000000 --- a/include/lldb/Utility/Utils.h +++ /dev/null @@ -1,22 +0,0 @@ -//===-- Utils.h -------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef utility_Utils_h_ -#define utility_Utils_h_ - -// These utilities have llvm namespace. -#include "llvm/ADT/STLExtras.h" - -namespace lldb_private { - -// Add lldb utilities here. - -} // namespace lldb_private - -#endif // utility_Utils diff --git a/include/lldb/Utility/VASPrintf.h b/include/lldb/Utility/VASPrintf.h new file mode 100644 index 000000000000..6e2404ecef93 --- /dev/null +++ b/include/lldb/Utility/VASPrintf.h @@ -0,0 +1,21 @@ +//===-- VASPrintf.h ---------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_UTILITY_VASPRINTF_H +#define LLDB_UTILITY_VASPRINTF_H + +#include "llvm/ADT/SmallVector.h" + +#include <cstdarg> + +namespace lldb_private { +bool VASprintf(llvm::SmallVectorImpl<char> &buf, const char *fmt, va_list args); +} + +#endif // #ifdef LLDB_UTILITY_VASPRINTF_H diff --git a/include/lldb/Core/VMRange.h b/include/lldb/Utility/VMRange.h index 4ec64c997553..98362f4d7608 100644 --- a/include/lldb/Core/VMRange.h +++ b/include/lldb/Utility/VMRange.h @@ -10,10 +10,17 @@ #ifndef liblldb_VMRange_h_ #define liblldb_VMRange_h_ -#include "lldb/lldb-private.h" +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t #include <vector> namespace lldb_private { +class Stream; +} + +namespace lldb_private { //---------------------------------------------------------------------- // A vm address range. These can represent offsets ranges or actual diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h index 8f70a59ca5fc..0970d691d802 100644 --- a/include/lldb/lldb-forward.h +++ b/include/lldb/lldb-forward.h @@ -127,7 +127,6 @@ class MemoryRegionInfo; class LineTable; class Listener; class Log; -class LogChannel; class Mangled; class Materializer; class MemoryHistory; @@ -362,7 +361,6 @@ typedef std::unique_ptr<lldb_private::SystemRuntime> SystemRuntimeUP; typedef std::shared_ptr<lldb_private::LineTable> LineTableSP; typedef std::shared_ptr<lldb_private::Listener> ListenerSP; typedef std::weak_ptr<lldb_private::Listener> ListenerWP; -typedef std::shared_ptr<lldb_private::LogChannel> LogChannelSP; typedef std::shared_ptr<lldb_private::MemoryHistory> MemoryHistorySP; typedef std::shared_ptr<lldb_private::MemoryRegionInfo> MemoryRegionInfoSP; typedef std::unique_ptr<lldb_private::MemoryRegionInfo> MemoryRegionInfoUP; diff --git a/include/lldb/lldb-private-enumerations.h b/include/lldb/lldb-private-enumerations.h index d6e30b33b3eb..9572bee81177 100644 --- a/include/lldb/lldb-private-enumerations.h +++ b/include/lldb/lldb-private-enumerations.h @@ -10,6 +10,10 @@ #ifndef LLDB_lldb_private_enumerations_h_ #define LLDB_lldb_private_enumerations_h_ +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/FormatProviders.h" +#include "llvm/Support/raw_ostream.h" + namespace lldb_private { //---------------------------------------------------------------------- @@ -112,19 +116,6 @@ typedef enum LazyBool { } LazyBool; //------------------------------------------------------------------ -/// Name matching -//------------------------------------------------------------------ -typedef enum NameMatchType { - eNameMatchIgnore, - eNameMatchEquals, - eNameMatchContains, - eNameMatchStartsWith, - eNameMatchEndsWith, - eNameMatchRegularExpression - -} NameMatchType; - -//------------------------------------------------------------------ /// Instruction types //------------------------------------------------------------------ typedef enum InstructionType { @@ -257,4 +248,24 @@ enum class CompilerContextKind { } // namespace lldb_private +namespace llvm { +template <> struct format_provider<lldb_private::Vote> { + static void format(const lldb_private::Vote &V, llvm::raw_ostream &Stream, + StringRef Style) { + switch (V) { + case lldb_private::eVoteNo: + Stream << "no"; + return; + case lldb_private::eVoteNoOpinion: + Stream << "no opinion"; + return; + case lldb_private::eVoteYes: + Stream << "yes"; + return; + } + Stream << "invalid"; + } +}; +} + #endif // LLDB_lldb_private_enumerations_h_ diff --git a/include/lldb/lldb-private-interfaces.h b/include/lldb/lldb-private-interfaces.h index c0d5c859a44e..d3e80075625e 100644 --- a/include/lldb/lldb-private-interfaces.h +++ b/include/lldb/lldb-private-interfaces.h @@ -16,6 +16,8 @@ #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" +#include "lldb/lldb-private-enumerations.h" + #include <set> namespace lldb_private { @@ -45,7 +47,6 @@ typedef ObjectFile *(*ObjectFileCreateMemoryInstance)( const lldb::ProcessSP &process_sp, lldb::addr_t offset); typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp, const FileSpec &outfile, Error &error); -typedef LogChannel *(*LogChannelCreateInstance)(); typedef EmulateInstruction *(*EmulateInstructionCreateInstance)( const ArchSpec &arch, InstructionType inst_type); typedef OperatingSystem *(*OperatingSystemCreateInstance)(Process *process, |