diff options
Diffstat (limited to 'include/lldb/Core')
63 files changed, 728 insertions, 2472 deletions
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h index 617aaefe91c9..a02a0d45a082 100644 --- a/include/lldb/Core/Address.h +++ b/include/lldb/Core/Address.h @@ -10,13 +10,13 @@ #ifndef liblldb_Address_h_ #define liblldb_Address_h_ -#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS -#include "lldb/lldb-forward.h" // for SectionWP, SectionSP, ModuleSP -#include "lldb/lldb-private-enumerations.h" // for AddressClass -#include "lldb/lldb-types.h" // for addr_t +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, UINT32_MAX, int64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class Block; @@ -508,9 +508,9 @@ public: /// /// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*) //------------------------------------------------------------------ - uint32_t CalculateSymbolContext( - SymbolContext *sc, - uint32_t resolve_scope = lldb::eSymbolContextEverything) const; + uint32_t CalculateSymbolContext(SymbolContext *sc, + lldb::SymbolContextItem resolve_scope = + lldb::eSymbolContextEverything) const; lldb::ModuleSP CalculateSymbolContextModule() const; diff --git a/include/lldb/Core/AddressRange.h b/include/lldb/Core/AddressRange.h index 9f69c87ee354..e3c820782aaf 100644 --- a/include/lldb/Core/AddressRange.h +++ b/include/lldb/Core/AddressRange.h @@ -11,10 +11,10 @@ #define liblldb_AddressRange_h_ #include "lldb/Core/Address.h" -#include "lldb/lldb-forward.h" // for SectionSP -#include "lldb/lldb-types.h" // for addr_t +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t +#include <stddef.h> namespace lldb_private { class SectionList; diff --git a/include/lldb/Core/AddressResolver.h b/include/lldb/Core/AddressResolver.h index cfd103e0be01..32751d64d6b4 100644 --- a/include/lldb/Core/AddressResolver.h +++ b/include/lldb/Core/AddressResolver.h @@ -12,9 +12,9 @@ #include "lldb/Core/AddressRange.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-defines.h" -#include <stddef.h> // for size_t +#include <stddef.h> #include <vector> namespace lldb_private { diff --git a/include/lldb/Core/AddressResolverFileLine.h b/include/lldb/Core/AddressResolverFileLine.h index e434a62e0319..bee72245ee6b 100644 --- a/include/lldb/Core/AddressResolverFileLine.h +++ b/include/lldb/Core/AddressResolverFileLine.h @@ -11,11 +11,11 @@ #define liblldb_AddressResolverFileLine_h_ #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 "lldb/Core/SearchFilter.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-defines.h" -#include <stdint.h> // for uint32_t +#include <stdint.h> namespace lldb_private { class Address; @@ -47,7 +47,7 @@ public: SymbolContext &context, Address *addr, bool containing) override; - Searcher::Depth GetDepth() override; + lldb::SearchDepth GetDepth() override; void GetDescription(Stream *s) override; diff --git a/include/lldb/Core/AddressResolverName.h b/include/lldb/Core/AddressResolverName.h index 49a805f2115a..b4291938b290 100644 --- a/include/lldb/Core/AddressResolverName.h +++ b/include/lldb/Core/AddressResolverName.h @@ -11,10 +11,10 @@ #define liblldb_AddressResolverName_h_ #include "lldb/Core/AddressResolver.h" -#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::Call... -#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Core/SearchFilter.h" +#include "lldb/Utility/ConstString.h" #include "lldb/Utility/RegularExpression.h" -#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-defines.h" namespace lldb_private { class Address; @@ -52,7 +52,7 @@ public: SymbolContext &context, Address *addr, bool containing) override; - Searcher::Depth GetDepth() override; + lldb::SearchDepth GetDepth() override; void GetDescription(Stream *s) override; diff --git a/include/lldb/Core/Architecture.h b/include/lldb/Core/Architecture.h index 3a5a9789223d..20537d67b02c 100644 --- a/include/lldb/Core/Architecture.h +++ b/include/lldb/Core/Architecture.h @@ -67,6 +67,51 @@ public: virtual void AdjustBreakpointAddress(const Symbol &func, Address &addr) const {} + + //------------------------------------------------------------------ + /// Get \a load_addr as a callable code load address for this target + /// + /// Take \a load_addr and potentially add any address bits that are + /// needed to make the address callable. For ARM this can set bit + /// zero (if it already isn't) if \a load_addr is a thumb function. + /// If \a addr_class is set to AddressClass::eInvalid, then the address + /// adjustment will always happen. If it is set to an address class + /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be + /// returned. + //------------------------------------------------------------------ + virtual lldb::addr_t GetCallableLoadAddress( + lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const { + return addr; + } + + //------------------------------------------------------------------ + /// Get \a load_addr as an opcode for this target. + /// + /// Take \a load_addr and potentially strip any address bits that are + /// needed to make the address point to an opcode. For ARM this can + /// clear bit zero (if it already isn't) if \a load_addr is a + /// thumb function and load_addr is in code. + /// If \a addr_class is set to AddressClass::eInvalid, then the address + /// adjustment will always happen. If it is set to an address class + /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be + /// returned. + //------------------------------------------------------------------ + + virtual lldb::addr_t GetOpcodeLoadAddress( + lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const { + return addr; + } + + // Get load_addr as breakable load address for this target. Take a addr and + // check if for any reason there is a better address than this to put a + // breakpoint on. If there is then return that address. For MIPS, if + // instruction at addr is a delay slot instruction then this method will find + // the address of its previous instruction and return that address. + virtual lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr, + Target &target) const { + return addr; + } + private: Architecture(const Architecture &) = delete; void operator=(const Architecture &) = delete; diff --git a/include/lldb/Core/Broadcaster.h b/include/lldb/Core/Broadcaster.h deleted file mode 100644 index 4851007c9a2a..000000000000 --- a/include/lldb/Core/Broadcaster.h +++ /dev/null @@ -1,598 +0,0 @@ -//===-- Broadcaster.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_Broadcaster_h_ -#define liblldb_Broadcaster_h_ - -#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> - -namespace lldb_private { -class Broadcaster; -} -namespace lldb_private { -class EventData; -} -namespace lldb_private { -class Listener; -} -namespace lldb_private { -class Stream; -} - -namespace lldb_private { - -//---------------------------------------------------------------------- -// lldb::BroadcastEventSpec -// -// This class is used to specify a kind of event to register for. The Debugger -// maintains a list of BroadcastEventSpec's and when it is made -//---------------------------------------------------------------------- -class BroadcastEventSpec { -public: - BroadcastEventSpec(const ConstString &broadcaster_class, uint32_t event_bits) - : m_broadcaster_class(broadcaster_class), m_event_bits(event_bits) {} - - BroadcastEventSpec(const BroadcastEventSpec &rhs); - - ~BroadcastEventSpec() = default; - - const ConstString &GetBroadcasterClass() const { return m_broadcaster_class; } - - uint32_t GetEventBits() const { return m_event_bits; } - - // Tell whether this BroadcastEventSpec is contained in in_spec. That is: (a) - // the two spec's share the same broadcaster class (b) the event bits of this - // spec are wholly contained in those of in_spec. - bool IsContainedIn(BroadcastEventSpec in_spec) const { - if (m_broadcaster_class != in_spec.GetBroadcasterClass()) - return false; - uint32_t in_bits = in_spec.GetEventBits(); - if (in_bits == m_event_bits) - return true; - else { - if ((m_event_bits & in_bits) != 0 && (m_event_bits & ~in_bits) == 0) - return true; - } - return false; - } - - bool operator<(const BroadcastEventSpec &rhs) const; - BroadcastEventSpec &operator=(const BroadcastEventSpec &rhs); - -private: - ConstString m_broadcaster_class; - uint32_t m_event_bits; -}; - -class BroadcasterManager - : public std::enable_shared_from_this<BroadcasterManager> { -public: - friend class Listener; - -protected: - BroadcasterManager(); - -public: - // Listeners hold onto weak pointers to their broadcaster managers. So they - // must be made into shared pointers, which you do with - // MakeBroadcasterManager. - - static lldb::BroadcasterManagerSP MakeBroadcasterManager(); - - ~BroadcasterManager() = default; - - uint32_t RegisterListenerForEvents(const lldb::ListenerSP &listener_sp, - BroadcastEventSpec event_spec); - - bool UnregisterListenerForEvents(const lldb::ListenerSP &listener_sp, - BroadcastEventSpec event_spec); - - lldb::ListenerSP GetListenerForEventSpec(BroadcastEventSpec event_spec) const; - - void SignUpListenersForBroadcaster(Broadcaster &broadcaster); - - void RemoveListener(const lldb::ListenerSP &listener_sp); - - void RemoveListener(Listener *listener); - - void Clear(); - -private: - typedef std::pair<BroadcastEventSpec, lldb::ListenerSP> event_listener_key; - typedef std::map<BroadcastEventSpec, lldb::ListenerSP> collection; - typedef std::set<lldb::ListenerSP> listener_collection; - collection m_event_map; - listener_collection m_listeners; - - mutable std::recursive_mutex m_manager_mutex; - - // A couple of comparator classes for find_if: - - class BroadcasterClassMatches { - public: - BroadcasterClassMatches(const ConstString &broadcaster_class) - : m_broadcaster_class(broadcaster_class) {} - - ~BroadcasterClassMatches() = default; - - bool operator()(const event_listener_key input) const { - return (input.first.GetBroadcasterClass() == m_broadcaster_class); - } - - private: - ConstString m_broadcaster_class; - }; - - class BroadcastEventSpecMatches { - public: - BroadcastEventSpecMatches(BroadcastEventSpec broadcaster_spec) - : m_broadcaster_spec(broadcaster_spec) {} - - ~BroadcastEventSpecMatches() = default; - - bool operator()(const event_listener_key input) const { - return (input.first.IsContainedIn(m_broadcaster_spec)); - } - - private: - BroadcastEventSpec m_broadcaster_spec; - }; - - class ListenerMatchesAndSharedBits { - public: - explicit ListenerMatchesAndSharedBits(BroadcastEventSpec broadcaster_spec, - const lldb::ListenerSP listener_sp) - : m_broadcaster_spec(broadcaster_spec), m_listener_sp(listener_sp) {} - - ~ListenerMatchesAndSharedBits() = default; - - bool operator()(const event_listener_key input) const { - return (input.first.GetBroadcasterClass() == - m_broadcaster_spec.GetBroadcasterClass() && - (input.first.GetEventBits() & - m_broadcaster_spec.GetEventBits()) != 0 && - input.second == m_listener_sp); - } - - private: - BroadcastEventSpec m_broadcaster_spec; - const lldb::ListenerSP m_listener_sp; - }; - - class ListenerMatches { - public: - explicit ListenerMatches(const lldb::ListenerSP in_listener_sp) - : m_listener_sp(in_listener_sp) {} - - ~ListenerMatches() = default; - - bool operator()(const event_listener_key input) const { - if (input.second == m_listener_sp) - return true; - else - return false; - } - - private: - const lldb::ListenerSP m_listener_sp; - }; - - class ListenerMatchesPointer { - public: - ListenerMatchesPointer(const Listener *in_listener) - : m_listener(in_listener) {} - - ~ListenerMatchesPointer() = default; - - bool operator()(const event_listener_key input) const { - if (input.second.get() == m_listener) - return true; - else - return false; - } - - bool operator()(const lldb::ListenerSP input) const { - if (input.get() == m_listener) - return true; - else - return false; - } - - private: - const Listener *m_listener; - }; -}; - -//---------------------------------------------------------------------- -/// @class Broadcaster Broadcaster.h "lldb/Core/Broadcaster.h" An event -/// broadcasting class. -/// -/// The Broadcaster class is designed to be subclassed by objects that wish to -/// vend events in a multi-threaded environment. Broadcaster objects can each -/// vend 32 events. Each event is represented by a bit in a 32 bit value and -/// these bits can be set: -/// @see Broadcaster::SetEventBits(uint32_t) -/// or cleared: -/// @see Broadcaster::ResetEventBits(uint32_t) -/// When an event gets set the Broadcaster object will notify the Listener -/// object that is listening for the event (if there is one). -/// -/// Subclasses should provide broadcast bit definitions for any events they -/// vend, typically using an enumeration: -/// \code -/// class Foo : public Broadcaster -/// { -/// public: -/// //---------------------------------------------------------- -/// // Broadcaster event bits definitions. -/// //---------------------------------------------------------- -/// enum -/// { -/// eBroadcastBitOne = (1 << 0), -/// eBroadcastBitTwo = (1 << 1), -/// eBroadcastBitThree = (1 << 2), -/// ... -/// }; -/// \endcode -//---------------------------------------------------------------------- -class Broadcaster { - friend class Listener; - friend class Event; - -public: - //------------------------------------------------------------------ - /// Construct with a broadcaster with a name. - /// - /// @param[in] name - /// A NULL terminated C string that contains the name of the - /// broadcaster object. - //------------------------------------------------------------------ - Broadcaster(lldb::BroadcasterManagerSP manager_sp, const char *name); - - //------------------------------------------------------------------ - /// Destructor. - /// - /// The destructor is virtual since this class gets subclassed. - //------------------------------------------------------------------ - virtual ~Broadcaster(); - - void CheckInWithManager(); - - //------------------------------------------------------------------ - /// Broadcast an event which has no associated data. - /// - /// @param[in] event_type - /// The element from the enum defining this broadcaster's events - /// that is being broadcast. - /// - /// @param[in] event_data - /// User event data that will be owned by the lldb::Event that - /// is created internally. - /// - /// @param[in] unique - /// If true, then only add an event of this type if there isn't - /// one already in the queue. - /// - //------------------------------------------------------------------ - void BroadcastEvent(lldb::EventSP &event_sp) { - m_broadcaster_sp->BroadcastEvent(event_sp); - } - - void BroadcastEventIfUnique(lldb::EventSP &event_sp) { - m_broadcaster_sp->BroadcastEventIfUnique(event_sp); - } - - void BroadcastEvent(uint32_t event_type, - const lldb::EventDataSP &event_data_sp) { - m_broadcaster_sp->BroadcastEvent(event_type, event_data_sp); - } - - void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr) { - m_broadcaster_sp->BroadcastEvent(event_type, event_data); - } - - void BroadcastEventIfUnique(uint32_t event_type, - EventData *event_data = nullptr) { - m_broadcaster_sp->BroadcastEventIfUnique(event_type, event_data); - } - - void Clear() { m_broadcaster_sp->Clear(); } - - virtual void AddInitialEventsToListener(const lldb::ListenerSP &listener_sp, - uint32_t requested_events); - - //------------------------------------------------------------------ - /// Listen for any events specified by \a event_mask. - /// - /// Only one listener can listen to each event bit in a given Broadcaster. - /// Once a listener has acquired an event bit, no other broadcaster will - /// have access to it until it is relinquished by the first listener that - /// gets it. The actual event bits that get acquired by \a listener may be - /// different from what is requested in \a event_mask, and to track this the - /// actual event bits that are acquired get returned. - /// - /// @param[in] listener - /// The Listener object that wants to monitor the events that - /// get broadcast by this object. - /// - /// @param[in] event_mask - /// A bit mask that indicates which events the listener is - /// asking to monitor. - /// - /// @return - /// The actual event bits that were acquired by \a listener. - //------------------------------------------------------------------ - uint32_t AddListener(const lldb::ListenerSP &listener_sp, - uint32_t event_mask) { - return m_broadcaster_sp->AddListener(listener_sp, event_mask); - } - - //------------------------------------------------------------------ - /// Get the NULL terminated C string name of this Broadcaster object. - /// - /// @return - /// The NULL terminated C string name of this Broadcaster. - //------------------------------------------------------------------ - const ConstString &GetBroadcasterName() { return m_broadcaster_name; } - - //------------------------------------------------------------------ - /// Get the event name(s) for one or more event bits. - /// - /// @param[in] event_mask - /// A bit mask that indicates which events to get names for. - /// - /// @return - /// The NULL terminated C string name of this Broadcaster. - //------------------------------------------------------------------ - bool GetEventNames(Stream &s, const uint32_t event_mask, - bool prefix_with_broadcaster_name) const { - return m_broadcaster_sp->GetEventNames(s, event_mask, - prefix_with_broadcaster_name); - } - - //------------------------------------------------------------------ - /// Set the name for an event bit. - /// - /// @param[in] event_mask - /// A bit mask that indicates which events the listener is - /// asking to monitor. - /// - /// @return - /// The NULL terminated C string name of this Broadcaster. - //------------------------------------------------------------------ - void SetEventName(uint32_t event_mask, const char *name) { - m_broadcaster_sp->SetEventName(event_mask, name); - } - - const char *GetEventName(uint32_t event_mask) const { - return m_broadcaster_sp->GetEventName(event_mask); - } - - bool EventTypeHasListeners(uint32_t event_type) { - return m_broadcaster_sp->EventTypeHasListeners(event_type); - } - - //------------------------------------------------------------------ - /// Removes a Listener from this broadcasters list and frees the event bits - /// specified by \a event_mask that were previously acquired by \a listener - /// (assuming \a listener was listening to this object) for other listener - /// objects to use. - /// - /// @param[in] listener - /// A Listener object that previously called AddListener. - /// - /// @param[in] event_mask - /// The event bits \a listener wishes to relinquish. - /// - /// @return - /// \b True if the listener was listening to this broadcaster - /// and was removed, \b false otherwise. - /// - /// @see uint32_t Broadcaster::AddListener (Listener*, uint32_t) - //------------------------------------------------------------------ - bool RemoveListener(const lldb::ListenerSP &listener_sp, - uint32_t event_mask = UINT32_MAX) { - return m_broadcaster_sp->RemoveListener(listener_sp, event_mask); - } - - //------------------------------------------------------------------ - /// Provides a simple mechanism to temporarily redirect events from - /// broadcaster. When you call this function passing in a listener and - /// event type mask, all events from the broadcaster matching the mask will - /// now go to the hijacking listener. Only one hijack can occur at a time. - /// If we need more than this we will have to implement a Listener stack. - /// - /// @param[in] listener - /// A Listener object. You do not need to call StartListeningForEvents - /// for this broadcaster (that would fail anyway since the event bits - /// would most likely be taken by the listener(s) you are usurping. - /// - /// @param[in] event_mask - /// The event bits \a listener wishes to hijack. - /// - /// @return - /// \b True if the event mask could be hijacked, \b false otherwise. - /// - /// @see uint32_t Broadcaster::AddListener (Listener*, uint32_t) - //------------------------------------------------------------------ - bool HijackBroadcaster(const lldb::ListenerSP &listener_sp, - uint32_t event_mask = UINT32_MAX) { - return m_broadcaster_sp->HijackBroadcaster(listener_sp, event_mask); - } - - bool IsHijackedForEvent(uint32_t event_mask) { - return m_broadcaster_sp->IsHijackedForEvent(event_mask); - } - - //------------------------------------------------------------------ - /// Restore the state of the Broadcaster from a previous hijack attempt. - /// - //------------------------------------------------------------------ - void RestoreBroadcaster() { m_broadcaster_sp->RestoreBroadcaster(); } - - // This needs to be filled in if you are going to register the broadcaster - // with the broadcaster manager and do broadcaster class matching. - // FIXME: Probably should make a ManagedBroadcaster subclass with all the bits - // needed to work - // with the BroadcasterManager, so that it is clearer how to add one. - virtual ConstString &GetBroadcasterClass() const; - - lldb::BroadcasterManagerSP GetManager(); - -protected: - // BroadcasterImpl contains the actual Broadcaster implementation. The - // Broadcaster makes a BroadcasterImpl which lives as long as it does. The - // Listeners & the Events hold a weak pointer to the BroadcasterImpl, so that - // they can survive if a Broadcaster they were listening to is destroyed w/o - // their being able to unregister from it (which can happen if the - // Broadcasters & Listeners are being destroyed on separate threads - // simultaneously. The Broadcaster itself can't be shared out as a weak - // pointer, because some things that are broadcasters (e.g. the Target and - // the Process) are shared in their own right. - // - // For the most part, the Broadcaster functions dispatch to the - // BroadcasterImpl, and are documented in the public Broadcaster API above. - - class BroadcasterImpl { - friend class Listener; - friend class Broadcaster; - - public: - BroadcasterImpl(Broadcaster &broadcaster); - - ~BroadcasterImpl() = default; - - void BroadcastEvent(lldb::EventSP &event_sp); - - void BroadcastEventIfUnique(lldb::EventSP &event_sp); - - void BroadcastEvent(uint32_t event_type, EventData *event_data = nullptr); - - void BroadcastEvent(uint32_t event_type, - const lldb::EventDataSP &event_data_sp); - - void BroadcastEventIfUnique(uint32_t event_type, - EventData *event_data = nullptr); - - void Clear(); - - uint32_t AddListener(const lldb::ListenerSP &listener_sp, - uint32_t event_mask); - - const char *GetBroadcasterName() const { - return m_broadcaster.GetBroadcasterName().AsCString(); - } - - Broadcaster *GetBroadcaster(); - - bool GetEventNames(Stream &s, const uint32_t event_mask, - bool prefix_with_broadcaster_name) const; - - void SetEventName(uint32_t event_mask, const char *name) { - m_event_names[event_mask] = name; - } - - const char *GetEventName(uint32_t event_mask) const { - const auto pos = m_event_names.find(event_mask); - if (pos != m_event_names.end()) - return pos->second.c_str(); - return nullptr; - } - - bool EventTypeHasListeners(uint32_t event_type); - - bool RemoveListener(lldb_private::Listener *listener, - uint32_t event_mask = UINT32_MAX); - - bool RemoveListener(const lldb::ListenerSP &listener_sp, - uint32_t event_mask = UINT32_MAX); - - bool HijackBroadcaster(const lldb::ListenerSP &listener_sp, - uint32_t event_mask = UINT32_MAX); - - bool IsHijackedForEvent(uint32_t event_mask); - - void RestoreBroadcaster(); - - protected: - void PrivateBroadcastEvent(lldb::EventSP &event_sp, bool unique); - - const char *GetHijackingListenerName(); - - //------------------------------------------------------------------ - // - //------------------------------------------------------------------ - typedef llvm::SmallVector<std::pair<lldb::ListenerWP, uint32_t>, 4> - collection; - typedef std::map<uint32_t, std::string> event_names_map; - - llvm::SmallVector<std::pair<lldb::ListenerSP, uint32_t &>, 4> - GetListeners(); - - Broadcaster &m_broadcaster; ///< The broadcaster that this implements - event_names_map m_event_names; ///< Optionally define event names for - ///readability and logging for each event bit - collection m_listeners; ///< A list of Listener / event_mask pairs that are - ///listening to this broadcaster. - std::recursive_mutex - m_listeners_mutex; ///< A mutex that protects \a m_listeners. - std::vector<lldb::ListenerSP> m_hijacking_listeners; // A simple mechanism - // to intercept events - // from a broadcaster - std::vector<uint32_t> m_hijacking_masks; // At some point we may want to - // have a stack or Listener - // collections, but for now this is just for private hijacking. - - private: - //------------------------------------------------------------------ - // For Broadcaster only - //------------------------------------------------------------------ - DISALLOW_COPY_AND_ASSIGN(BroadcasterImpl); - }; - - typedef std::shared_ptr<BroadcasterImpl> BroadcasterImplSP; - typedef std::weak_ptr<BroadcasterImpl> BroadcasterImplWP; - - BroadcasterImplSP GetBroadcasterImpl() { return m_broadcaster_sp; } - - const char *GetHijackingListenerName() { - return m_broadcaster_sp->GetHijackingListenerName(); - } - //------------------------------------------------------------------ - // Classes that inherit from Broadcaster can see and modify these - //------------------------------------------------------------------ - -private: - //------------------------------------------------------------------ - // For Broadcaster only - //------------------------------------------------------------------ - BroadcasterImplSP m_broadcaster_sp; - lldb::BroadcasterManagerSP m_manager_sp; - const ConstString - m_broadcaster_name; ///< The name of this broadcaster object. - - DISALLOW_COPY_AND_ASSIGN(Broadcaster); -}; - -} // namespace lldb_private - -#endif // liblldb_Broadcaster_h_ diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h index b3cab8a22f21..3fc12a555301 100644 --- a/include/lldb/Core/ClangForward.h +++ b/include/lldb/Core/ClangForward.h @@ -10,10 +10,6 @@ #ifndef liblldb_ClangForward_h_ #define liblldb_ClangForward_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #if defined(__cplusplus) diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h index 3e29307039e4..f129b8f879d0 100644 --- a/include/lldb/Core/Communication.h +++ b/include/lldb/Core/Communication.h @@ -10,21 +10,21 @@ #ifndef liblldb_Communication_h_ #define liblldb_Communication_h_ -#include "lldb/Core/Broadcaster.h" #include "lldb/Host/HostThread.h" +#include "lldb/Utility/Broadcaster.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 "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" #include <atomic> #include <mutex> -#include <ratio> // for micro +#include <ratio> #include <string> -#include <stddef.h> // for size_t -#include <stdint.h> // for uint8_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class Connection; diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h index cc7176e5c95d..09f75ef0f8c6 100644 --- a/include/lldb/Core/Debugger.h +++ b/include/lldb/Core/Debugger.h @@ -10,44 +10,40 @@ #ifndef liblldb_Debugger_h_ #define liblldb_Debugger_h_ -// C Includes #include <stdint.h> -// C++ Includes #include <memory> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Broadcaster.h" #include "lldb/Core/FormatEntity.h" #include "lldb/Core/IOHandler.h" #include "lldb/Core/SourceManager.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/ExecutionContext.h" #include "lldb/Target/Platform.h" #include "lldb/Target/TargetList.h" -#include "lldb/Utility/ConstString.h" // for ConstString -#include "lldb/Utility/FileSpec.h" // for FileSpec -#include "lldb/Utility/Status.h" // for Status +#include "lldb/Utility/Broadcaster.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #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 "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-private-types.h" +#include "lldb/lldb-types.h" -#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/ADT/ArrayRef.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/DynamicLibrary.h" #include "llvm/Support/Threading.h" -#include <assert.h> // for assert -#include <stddef.h> // for size_t +#include <assert.h> +#include <stddef.h> #include <stdio.h> namespace lldb_private { @@ -192,7 +188,8 @@ public: lldb::StreamFileSP &out, lldb::StreamFileSP &err); - void PushIOHandler(const lldb::IOHandlerSP &reader_sp); + void PushIOHandler(const lldb::IOHandlerSP &reader_sp, + bool cancel_top_handler = true); bool PopIOHandler(const lldb::IOHandlerSP &reader_sp); @@ -264,6 +261,8 @@ public: void SetPrompt(llvm::StringRef p); void SetPrompt(const char *) = delete; + llvm::StringRef GetReproducerPath() const; + bool GetUseExternalEditor() const; bool SetUseExternalEditor(bool use_external_editor_p); @@ -272,11 +271,13 @@ public: bool SetUseColor(bool use_color); + bool GetHighlightSource() const; + lldb::StopShowColumn GetStopShowColumn() const; - const FormatEntity::Entry *GetStopShowColumnAnsiPrefix() const; + llvm::StringRef GetStopShowColumnAnsiPrefix() const; - const FormatEntity::Entry *GetStopShowColumnAnsiSuffix() const; + llvm::StringRef GetStopShowColumnAnsiSuffix() const; uint32_t GetStopSourceLineCount(bool before) const; diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h index ef1f2ee54dd1..7cec837e71f8 100644 --- a/include/lldb/Core/Disassembler.h +++ b/include/lldb/Core/Disassembler.h @@ -12,32 +12,32 @@ #include "lldb/Core/Address.h" #include "lldb/Core/EmulateInstruction.h" -#include "lldb/Core/FormatEntity.h" // for FormatEntity +#include "lldb/Core/FormatEntity.h" #include "lldb/Core/Opcode.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Symbol/LineEntry.h" -#include "lldb/Target/ExecutionContext.h" // for ExecutionContext +#include "lldb/Target/ExecutionContext.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/ConstString.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN -#include "lldb/lldb-forward.h" // for InstructionSP, DisassemblerSP -#include "lldb/lldb-private-enumerations.h" // for AddressClass -#include "lldb/lldb-types.h" // for addr_t, offset_t +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-types.h" -#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/ADT/StringRef.h" -#include <functional> // for function +#include <functional> #include <map> -#include <memory> // for enable_shared_from_this +#include <memory> #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 +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> namespace lldb_private { class AddressRange; diff --git a/include/lldb/Core/DumpDataExtractor.h b/include/lldb/Core/DumpDataExtractor.h index 46e676c239d1..88446d48fa64 100644 --- a/include/lldb/Core/DumpDataExtractor.h +++ b/include/lldb/Core/DumpDataExtractor.h @@ -10,11 +10,11 @@ #ifndef LLDB_CORE_DUMPDATAEXTRACTOR_H #define LLDB_CORE_DUMPDATAEXTRACTOR_H -#include "lldb/lldb-enumerations.h" // for Format +#include "lldb/lldb-enumerations.h" #include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class DataExtractor; diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h index 5d23bcd7b96e..5198f3eac922 100644 --- a/include/lldb/Core/EmulateInstruction.h +++ b/include/lldb/Core/EmulateInstruction.h @@ -12,18 +12,18 @@ #include <string> -#include "lldb/Core/Address.h" // for Address +#include "lldb/Core/Address.h" #include "lldb/Core/Opcode.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Utility/ArchSpec.h" -#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 "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-private-types.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t, int64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class OptionValueDictionary; } diff --git a/include/lldb/Core/Event.h b/include/lldb/Core/Event.h deleted file mode 100644 index fa3017057675..000000000000 --- a/include/lldb/Core/Event.h +++ /dev/null @@ -1,274 +0,0 @@ -//===-- Event.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_Event_h_ -#define liblldb_Event_h_ - -#include "lldb/Core/Broadcaster.h" -#include "lldb/Host/Predicate.h" -#include "lldb/Utility/ConstString.h" -#include "lldb/Utility/StructuredData.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> - -#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 { - -//---------------------------------------------------------------------- -// lldb::EventData -//---------------------------------------------------------------------- -class EventData { - friend class Event; - -public: - EventData(); - - virtual ~EventData(); - - virtual const ConstString &GetFlavor() const = 0; - - virtual void Dump(Stream *s) const; - -private: - virtual void DoOnRemoval(Event *event_ptr) {} - - DISALLOW_COPY_AND_ASSIGN(EventData); -}; - -//---------------------------------------------------------------------- -// lldb::EventDataBytes -//---------------------------------------------------------------------- -class EventDataBytes : public EventData { -public: - //------------------------------------------------------------------ - // Constructors - //------------------------------------------------------------------ - EventDataBytes(); - - EventDataBytes(const char *cstr); - - EventDataBytes(llvm::StringRef str); - - EventDataBytes(const void *src, size_t src_len); - - ~EventDataBytes() override; - - //------------------------------------------------------------------ - // Member functions - //------------------------------------------------------------------ - const ConstString &GetFlavor() const override; - - void Dump(Stream *s) const override; - - const void *GetBytes() const; - - size_t GetByteSize() const; - - void SetBytes(const void *src, size_t src_len); - - void SwapBytes(std::string &new_bytes); - - void SetBytesFromCString(const char *cstr); - - //------------------------------------------------------------------ - // Static functions - //------------------------------------------------------------------ - static const EventDataBytes *GetEventDataFromEvent(const Event *event_ptr); - - static const void *GetBytesFromEvent(const Event *event_ptr); - - static size_t GetByteSizeFromEvent(const Event *event_ptr); - - static const ConstString &GetFlavorString(); - -private: - std::string m_bytes; - - DISALLOW_COPY_AND_ASSIGN(EventDataBytes); -}; - -class EventDataReceipt : public EventData { -public: - EventDataReceipt() : EventData(), m_predicate(false) {} - - ~EventDataReceipt() override {} - - static const ConstString &GetFlavorString() { - static ConstString g_flavor("Process::ProcessEventData"); - return g_flavor; - } - - const ConstString &GetFlavor() const override { return GetFlavorString(); } - - bool WaitForEventReceived(const Timeout<std::micro> &timeout = llvm::None) { - return m_predicate.WaitForValueEqualTo(true, timeout); - } - -private: - Predicate<bool> m_predicate; - - void DoOnRemoval(Event *event_ptr) override { - m_predicate.SetValue(true, eBroadcastAlways); - } -}; - -//---------------------------------------------------------------------- -/// This class handles one or more StructuredData::Dictionary entries -/// that are raised for structured data events. -//---------------------------------------------------------------------- - -class EventDataStructuredData : public EventData { -public: - //------------------------------------------------------------------ - // Constructors - //------------------------------------------------------------------ - EventDataStructuredData(); - - EventDataStructuredData(const lldb::ProcessSP &process_sp, - const StructuredData::ObjectSP &object_sp, - const lldb::StructuredDataPluginSP &plugin_sp); - - ~EventDataStructuredData() override; - - //------------------------------------------------------------------ - // Member functions - //------------------------------------------------------------------ - const ConstString &GetFlavor() const override; - - void Dump(Stream *s) const override; - - const lldb::ProcessSP &GetProcess() const; - - const StructuredData::ObjectSP &GetObject() const; - - const lldb::StructuredDataPluginSP &GetStructuredDataPlugin() const; - - void SetProcess(const lldb::ProcessSP &process_sp); - - void SetObject(const StructuredData::ObjectSP &object_sp); - - void SetStructuredDataPlugin(const lldb::StructuredDataPluginSP &plugin_sp); - - //------------------------------------------------------------------ - // Static functions - //------------------------------------------------------------------ - static const EventDataStructuredData * - GetEventDataFromEvent(const Event *event_ptr); - - static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr); - - static StructuredData::ObjectSP GetObjectFromEvent(const Event *event_ptr); - - static lldb::StructuredDataPluginSP - GetPluginFromEvent(const Event *event_ptr); - - static const ConstString &GetFlavorString(); - -private: - lldb::ProcessSP m_process_sp; - StructuredData::ObjectSP m_object_sp; - lldb::StructuredDataPluginSP m_plugin_sp; - - DISALLOW_COPY_AND_ASSIGN(EventDataStructuredData); -}; - -//---------------------------------------------------------------------- -// lldb::Event -//---------------------------------------------------------------------- -class Event { - friend class Listener; - friend class EventData; - friend class Broadcaster::BroadcasterImpl; - -public: - Event(Broadcaster *broadcaster, uint32_t event_type, - EventData *data = nullptr); - - Event(Broadcaster *broadcaster, uint32_t event_type, - const lldb::EventDataSP &event_data_sp); - - Event(uint32_t event_type, EventData *data = nullptr); - - Event(uint32_t event_type, const lldb::EventDataSP &event_data_sp); - - ~Event(); - - void Dump(Stream *s) const; - - EventData *GetData() { return m_data_sp.get(); } - - const EventData *GetData() const { return m_data_sp.get(); } - - void SetData(EventData *new_data) { m_data_sp.reset(new_data); } - - uint32_t GetType() const { return m_type; } - - void SetType(uint32_t new_type) { m_type = new_type; } - - Broadcaster *GetBroadcaster() const { - Broadcaster::BroadcasterImplSP broadcaster_impl_sp = - m_broadcaster_wp.lock(); - if (broadcaster_impl_sp) - return broadcaster_impl_sp->GetBroadcaster(); - else - return nullptr; - } - - bool BroadcasterIs(Broadcaster *broadcaster) { - Broadcaster::BroadcasterImplSP broadcaster_impl_sp = - m_broadcaster_wp.lock(); - if (broadcaster_impl_sp) - return broadcaster_impl_sp->GetBroadcaster() == broadcaster; - else - return false; - } - - void Clear() { m_data_sp.reset(); } - -private: - // This is only called by Listener when it pops an event off the queue for - // the listener. It calls the Event Data's DoOnRemoval() method, which is - // virtual and can be overridden by the specific data classes. - - void DoOnRemoval(); - - // Called by Broadcaster::BroadcastEvent prior to letting all the listeners - // know about it update the contained broadcaster so that events can be - // popped off one queue and re-broadcast to others. - void SetBroadcaster(Broadcaster *broadcaster) { - m_broadcaster_wp = broadcaster->GetBroadcasterImpl(); - } - - Broadcaster::BroadcasterImplWP - m_broadcaster_wp; // The broadcaster that sent this event - uint32_t m_type; // The bit describing this event - lldb::EventDataSP m_data_sp; // User specific data for this event - - DISALLOW_COPY_AND_ASSIGN(Event); - Event(); // Disallow default constructor -}; - -} // namespace lldb_private - -#endif // liblldb_Event_h_ diff --git a/include/lldb/Core/FileLineResolver.h b/include/lldb/Core/FileLineResolver.h index 855d749ed5d4..6de99bc0c4dc 100644 --- a/include/lldb/Core/FileLineResolver.h +++ b/include/lldb/Core/FileLineResolver.h @@ -10,12 +10,12 @@ #ifndef liblldb_FileLineResolver_h_ #define liblldb_FileLineResolver_h_ -#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::CallbackR... +#include "lldb/Core/SearchFilter.h" #include "lldb/Symbol/SymbolContext.h" -#include "lldb/Utility/FileSpec.h" // for FileSpec -#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-defines.h" -#include <stdint.h> // for uint32_t, UINT32_MAX +#include <stdint.h> namespace lldb_private { class Address; @@ -48,7 +48,7 @@ public: SymbolContext &context, Address *addr, bool containing) override; - Searcher::Depth GetDepth() override; + lldb::SearchDepth GetDepth() override; void GetDescription(Stream *s) override; diff --git a/include/lldb/Core/FileSpecList.h b/include/lldb/Core/FileSpecList.h index 713ed2aaffc6..db6490ef7133 100644 --- a/include/lldb/Core/FileSpecList.h +++ b/include/lldb/Core/FileSpecList.h @@ -15,7 +15,7 @@ #include <vector> -#include <stddef.h> // for size_t +#include <stddef.h> namespace lldb_private { class Stream; diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h index 93c7b3a94e4e..b58f3b104e46 100644 --- a/include/lldb/Core/FormatEntity.h +++ b/include/lldb/Core/FormatEntity.h @@ -11,13 +11,13 @@ #define liblldb_FormatEntity_h_ #include "lldb/Utility/CompletionRequest.h" -#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" -#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 "lldb/lldb-enumerations.h" +#include "lldb/lldb-types.h" +#include <algorithm> +#include <stddef.h> +#include <stdint.h> #include <string> #include <vector> @@ -88,6 +88,7 @@ public: FrameRegisterFP, FrameRegisterFlags, FrameRegisterByName, + FrameIsArtificial, ScriptFrame, FunctionID, FunctionDidChange, @@ -104,6 +105,7 @@ public: FunctionIsOptimized, LineEntryFile, LineEntryLineNumber, + LineEntryColumn, LineEntryStartAddress, LineEntryEndAddress, CurrentPCArrow diff --git a/include/lldb/Core/Highlighter.h b/include/lldb/Core/Highlighter.h new file mode 100644 index 000000000000..220557c1f032 --- /dev/null +++ b/include/lldb/Core/Highlighter.h @@ -0,0 +1,165 @@ +//===-- Highlighter.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_Highlighter_h_ +#define liblldb_Highlighter_h_ + +#include <utility> +#include <vector> + +#include "lldb/Utility/Stream.h" +#include "lldb/lldb-enumerations.h" +#include "llvm/ADT/StringRef.h" + +namespace lldb_private { + +//---------------------------------------------------------------------- +/// Represents style that the highlighter should apply to the given source code. +/// Stores information about how every kind of token should be annotated. +//---------------------------------------------------------------------- +struct HighlightStyle { + + //---------------------------------------------------------------------- + /// A pair of strings that should be placed around a certain token. Usually + /// stores color codes in these strings (the suffix string is often used for + /// resetting the terminal attributes back to normal). + //---------------------------------------------------------------------- + class ColorStyle { + std::string m_prefix; + std::string m_suffix; + + public: + ColorStyle() = default; + ColorStyle(llvm::StringRef prefix, llvm::StringRef suffix) { + Set(prefix, suffix); + } + + /// Applies this style to the given value. + /// \param s + /// The stream to which the result should be appended. + /// \param value + /// The value that we should place our strings around. + void Apply(Stream &s, llvm::StringRef value) const; + + /// Sets the prefix and suffix strings. + /// @param prefix + /// @param suffix + void Set(llvm::StringRef prefix, llvm::StringRef suffix); + }; + + /// The style for the token which is below the cursor of the user. Note that + /// this style is overwritten by the SourceManager with the values of + /// stop-show-column-ansi-prefix/stop-show-column-ansi-suffix. + ColorStyle selected; + + /// Matches identifiers to variable or functions. + ColorStyle identifier; + /// Matches any string or character literals in the language: "foo" or 'f' + ColorStyle string_literal; + /// Matches scalar value literals like '42' or '0.1'. + ColorStyle scalar_literal; + /// Matches all reserved keywords in the language. + ColorStyle keyword; + /// Matches any comments in the language. + ColorStyle comment; + /// Matches commas: ',' + ColorStyle comma; + /// Matches one colon: ':' + ColorStyle colon; + /// Matches any semicolon: ';' + ColorStyle semicolons; + /// Matches operators like '+', '-', '%', '&', '=' + ColorStyle operators; + + /// Matches '{' or '}' + ColorStyle braces; + /// Matches '[' or ']' + ColorStyle square_brackets; + /// Matches '(' or ')' + ColorStyle parentheses; + + //----------------------------------------------------------------------- + // C language specific options + //----------------------------------------------------------------------- + + /// Matches directives to a preprocessor (if the language has any). + ColorStyle pp_directive; + + /// Returns a HighlightStyle that is based on vim's default highlight style. + static HighlightStyle MakeVimStyle(); +}; + +//---------------------------------------------------------------------- +/// Annotates source code with color attributes. +//---------------------------------------------------------------------- +class Highlighter { +public: + Highlighter() = default; + virtual ~Highlighter() = default; + DISALLOW_COPY_AND_ASSIGN(Highlighter); + + /// Returns a human readable name for the selected highlighter. + virtual llvm::StringRef GetName() const = 0; + + /// Highlights the given line + /// \param options + /// \param line + /// The user supplied line that needs to be highlighted. + /// \param cursor_pos + /// The cursor position of the user in this line, starting at 0 (which + /// means the cursor is on the first character in 'line'). + /// \param previous_lines + /// Any previous lines the user has written which we should only use + /// for getting the context of the Highlighting right. + /// \param s + /// The stream to which the highlighted version of the user string should + /// be written. + virtual void Highlight(const HighlightStyle &options, llvm::StringRef line, + llvm::Optional<size_t> cursor_pos, + llvm::StringRef previous_lines, Stream &s) const = 0; + + /// Utility method for calling Highlight without a stream. + std::string Highlight(const HighlightStyle &options, llvm::StringRef line, + llvm::Optional<size_t> cursor_pos, + llvm::StringRef previous_lines = "") const; +}; + +/// A default highlighter that only highlights the user cursor, but doesn't +/// do any other highlighting. +class DefaultHighlighter : public Highlighter { +public: + llvm::StringRef GetName() const override { return "none"; } + + void Highlight(const HighlightStyle &options, llvm::StringRef line, + llvm::Optional<size_t> cursor_pos, + llvm::StringRef previous_lines, Stream &s) const override; +}; + +/// Manages the available highlighters. +class HighlighterManager { + DefaultHighlighter m_default; + +public: + /// Queries all known highlighter for one that can highlight some source code. + /// \param language_type + /// The language type that the caller thinks the source code was given in. + /// \param path + /// The path to the file the source code is from. Used as a fallback when + /// the user can't provide a language. + /// \return + /// The highlighter that wants to highlight the source code. Could be an + /// empty highlighter that does nothing. + const Highlighter &getHighlighterFor(lldb::LanguageType language_type, + llvm::StringRef path) const; + const Highlighter &getDefaultHighlighter() const { return m_default; } +}; + +} // namespace lldb_private + +#endif // liblldb_Highlighter_h_ diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h index 2170ad10674e..4bd577390b2c 100644 --- a/include/lldb/Core/IOHandler.h +++ b/include/lldb/Core/IOHandler.h @@ -11,22 +11,22 @@ #define liblldb_IOHandler_h_ #include "lldb/Core/ValueObjectList.h" -#include "lldb/Host/Predicate.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" +#include "lldb/Utility/Predicate.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 +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringRef.h" #include <memory> #include <mutex> #include <string> #include <vector> -#include <stdint.h> // for uint32_t -#include <stdio.h> // for FILE +#include <stdint.h> +#include <stdio.h> namespace lldb_private { class Debugger; @@ -205,7 +205,7 @@ public: virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line, const char *cursor, const char *last_char, int skip_first_n_matches, int max_matches, - StringList &matches); + StringList &matches, StringList &descriptions); virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; } @@ -430,7 +430,8 @@ private: static int AutoCompleteCallback(const char *current_line, const char *cursor, const char *last_char, int skip_first_n_matches, int max_matches, - StringList &matches, void *baton); + StringList &matches, StringList &descriptions, + void *baton); #endif protected: @@ -464,7 +465,7 @@ public: int IOHandlerComplete(IOHandler &io_handler, const char *current_line, const char *cursor, const char *last_char, int skip_first_n_matches, int max_matches, - StringList &matches) override; + StringList &matches, StringList &descriptions) override; void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override; diff --git a/include/lldb/Core/Listener.h b/include/lldb/Core/Listener.h deleted file mode 100644 index 3d12f8fb3391..000000000000 --- a/include/lldb/Core/Listener.h +++ /dev/null @@ -1,161 +0,0 @@ -//===-- Listener.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_Select_h_ -#define liblldb_Select_h_ - -#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> - -#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 { - -class Listener : public std::enable_shared_from_this<Listener> { -public: - typedef bool (*HandleBroadcastCallback)(lldb::EventSP &event_sp, void *baton); - - friend class Broadcaster; - friend class BroadcasterManager; - - //------------------------------------------------------------------ - // Constructors and Destructors - //------------------------------------------------------------------ - // - // Listeners have to be constructed into shared pointers - at least if you - // want them to listen to Broadcasters, -protected: - Listener(const char *name); - -public: - static lldb::ListenerSP MakeListener(const char *name); - - ~Listener(); - - void AddEvent(lldb::EventSP &event); - - void Clear(); - - const char *GetName() { return m_name.c_str(); } - - uint32_t StartListeningForEventSpec(lldb::BroadcasterManagerSP manager_sp, - const BroadcastEventSpec &event_spec); - - bool StopListeningForEventSpec(lldb::BroadcasterManagerSP manager_sp, - const BroadcastEventSpec &event_spec); - - uint32_t StartListeningForEvents(Broadcaster *broadcaster, - uint32_t event_mask); - - uint32_t StartListeningForEvents(Broadcaster *broadcaster, - uint32_t event_mask, - HandleBroadcastCallback callback, - void *callback_user_data); - - bool StopListeningForEvents(Broadcaster *broadcaster, uint32_t event_mask); - - Event *PeekAtNextEvent(); - - Event *PeekAtNextEventForBroadcaster(Broadcaster *broadcaster); - - Event *PeekAtNextEventForBroadcasterWithType(Broadcaster *broadcaster, - uint32_t event_type_mask); - - // Returns true if an event was received, false if we timed out. - bool GetEvent(lldb::EventSP &event_sp, const Timeout<std::micro> &timeout); - - bool GetEventForBroadcaster(Broadcaster *broadcaster, lldb::EventSP &event_sp, - const Timeout<std::micro> &timeout); - - bool GetEventForBroadcasterWithType(Broadcaster *broadcaster, - uint32_t event_type_mask, - lldb::EventSP &event_sp, - const Timeout<std::micro> &timeout); - - size_t HandleBroadcastEvent(lldb::EventSP &event_sp); - -private: - //------------------------------------------------------------------ - // Classes that inherit from Listener can see and modify these - //------------------------------------------------------------------ - struct BroadcasterInfo { - BroadcasterInfo(uint32_t mask, HandleBroadcastCallback cb = nullptr, - void *ud = nullptr) - : event_mask(mask), callback(cb), callback_user_data(ud) {} - - uint32_t event_mask; - HandleBroadcastCallback callback; - void *callback_user_data; - }; - - typedef std::multimap<Broadcaster::BroadcasterImplWP, BroadcasterInfo, - std::owner_less<Broadcaster::BroadcasterImplWP>> - broadcaster_collection; - typedef std::list<lldb::EventSP> event_collection; - typedef std::vector<lldb::BroadcasterManagerWP> - broadcaster_manager_collection; - - bool - FindNextEventInternal(std::unique_lock<std::mutex> &lock, - Broadcaster *broadcaster, // nullptr for any broadcaster - const ConstString *sources, // nullptr for any event - uint32_t num_sources, uint32_t event_type_mask, - lldb::EventSP &event_sp, bool remove); - - bool GetEventInternal(const Timeout<std::micro> &timeout, - Broadcaster *broadcaster, // nullptr for any broadcaster - const ConstString *sources, // nullptr for any event - uint32_t num_sources, uint32_t event_type_mask, - lldb::EventSP &event_sp); - - std::string m_name; - broadcaster_collection m_broadcasters; - std::recursive_mutex m_broadcasters_mutex; // Protects m_broadcasters - event_collection m_events; - std::mutex m_events_mutex; // Protects m_broadcasters and m_events - std::condition_variable m_events_condition; - broadcaster_manager_collection m_broadcaster_managers; - - void BroadcasterWillDestruct(Broadcaster *); - - void BroadcasterManagerWillDestruct(lldb::BroadcasterManagerSP manager_sp); - - // broadcaster_collection::iterator - // FindBroadcasterWithMask (Broadcaster *broadcaster, - // uint32_t event_mask, - // bool exact); - - //------------------------------------------------------------------ - // For Listener only - //------------------------------------------------------------------ - DISALLOW_COPY_AND_ASSIGN(Listener); -}; - -} // namespace lldb_private - -#endif // liblldb_Select_h_ diff --git a/include/lldb/Core/LoadedModuleInfoList.h b/include/lldb/Core/LoadedModuleInfoList.h index 6554c64fa870..5ef0f8929b89 100644 --- a/include/lldb/Core/LoadedModuleInfoList.h +++ b/include/lldb/Core/LoadedModuleInfoList.h @@ -10,14 +10,11 @@ #ifndef liblldb_LoadedModuleInfoList_h_ #define liblldb_LoadedModuleInfoList_h_ -// C Includes -// C++ Includes #include <cassert> #include <string> #include <vector> -// Other libraries and framework includes #include "lldb/lldb-defines.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-types.h" diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h index d263297ecfc6..12edf8200e43 100644 --- a/include/lldb/Core/Mangled.h +++ b/include/lldb/Core/Mangled.h @@ -11,18 +11,15 @@ #define liblldb_Mangled_h_ #if defined(__cplusplus) +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" + #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 +#include "llvm/ADT/StringRef.h" -namespace lldb_private { -class RegularExpression; -} -namespace lldb_private { -class Stream; -} +#include <memory> +#include <stddef.h> namespace lldb_private { @@ -238,7 +235,6 @@ public: return true; return GetDemangledName(language) == name; } - bool NameMatches(const RegularExpression ®ex, lldb::LanguageType language) const; @@ -300,6 +296,36 @@ public: //---------------------------------------------------------------------- lldb::LanguageType GuessLanguage() const; + /// Function signature for filtering mangled names. + using SkipMangledNameFn = bool(llvm::StringRef, ManglingScheme); + + //---------------------------------------------------------------------- + /// Trigger explicit demangling to obtain rich mangling information. This is + /// optimized for batch processing while populating a name index. To get the + /// pure demangled name string for a single entity, use GetDemangledName() + /// instead. + /// + /// For names that match the Itanium mangling scheme, this uses LLVM's + /// ItaniumPartialDemangler. All other names fall back to LLDB's builtin + /// parser currently. + /// + /// This function is thread-safe when used with different \a context + /// instances in different threads. + /// + /// @param[in] context + /// The context for this function. A single instance can be stack- + /// allocated in the caller's frame and used for multiple calls. + /// + /// @param[in] skip_mangled_name + /// A filtering function for skipping entities based on name and mangling + /// scheme. This can be null if unused. + /// + /// @return + /// True on success, false otherwise. + //---------------------------------------------------------------------- + bool DemangleWithRichManglingInfo(RichManglingContext &context, + SkipMangledNameFn *skip_mangled_name); + private: //---------------------------------------------------------------------- /// Mangled member variables. diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h index 1bdf59c73649..8d9a91e69079 100644 --- a/include/lldb/Core/MappedHash.h +++ b/include/lldb/Core/MappedHash.h @@ -10,18 +10,14 @@ #ifndef liblldb_MappedHash_h_ #define liblldb_MappedHash_h_ -// C Includes #include <assert.h> #include <stdint.h> -// C++ Includes #include <algorithm> #include <functional> #include <map> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/Stream.h" #include "llvm/Support/DJB.h" diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 83d5f519f086..270a401172fa 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -10,31 +10,31 @@ #ifndef liblldb_Module_h_ #define liblldb_Module_h_ -#include "lldb/Core/Address.h" // for Address -#include "lldb/Core/ModuleSpec.h" // for ModuleSpec -#include "lldb/Symbol/ObjectFile.h" // for ObjectFile +#include "lldb/Core/Address.h" +#include "lldb/Core/ModuleSpec.h" +#include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContextScope.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/ArchSpec.h" -#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/ConstString.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Status.h" // for Status +#include "lldb/Utility/Status.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-defines.h" +#include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" -#include "lldb/lldb-types.h" // for addr_t, offset_t +#include "lldb/lldb-types.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Chrono.h" #include <atomic> -#include <memory> // for enable_shared_from_this +#include <memory> #include <mutex> -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t +#include <stddef.h> +#include <stdint.h> #include <string> #include <vector> @@ -168,10 +168,11 @@ public: // Once we get the object file, update our module with the object file's // architecture since it might differ in vendor/os if some parts were // unknown. - if (!module_sp->m_objfile_sp->GetArchitecture(module_sp->m_arch)) - return nullptr; - - return module_sp; + if (ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture()) { + module_sp->m_arch = arch; + return module_sp; + } + return nullptr; } //------------------------------------------------------------------ @@ -380,7 +381,7 @@ public: //------------------------------------------------------------------ size_t FindFunctions(const ConstString &name, const CompilerDeclContext *parent_decl_ctx, - uint32_t name_type_mask, bool symbols_ok, + lldb::FunctionNameType name_type_mask, bool symbols_ok, bool inlines_ok, bool append, SymbolContextList &sc_list); @@ -498,10 +499,6 @@ public: /// have to specify complete scoping on all expressions, but it also allows /// for exact matching when required. /// - /// @param[in] sc - /// A symbol context that scopes where to extract a type list - /// from. - /// /// @param[in] type_name /// The name of the type we are looking for that is a fully /// or partially qualified type name. @@ -520,8 +517,7 @@ public: /// The number of matches added to \a type_list. //------------------------------------------------------------------ size_t - FindTypes(const SymbolContext &sc, const ConstString &type_name, - bool exact_match, size_t max_matches, + FindTypes(const ConstString &type_name, bool exact_match, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeList &types); @@ -533,10 +529,6 @@ public: /// expression parser when searches need to happen in an exact namespace /// scope. /// - /// @param[in] sc - /// A symbol context that scopes where to extract a type list - /// from. - /// /// @param[in] type_name /// The name of a type within a namespace that should not include /// any qualifying namespaces (just a type basename). @@ -550,8 +542,7 @@ public: /// @return /// The number of matches added to \a type_list. //------------------------------------------------------------------ - size_t FindTypesInNamespace(const SymbolContext &sc, - const ConstString &type_name, + size_t FindTypesInNamespace(const ConstString &type_name, const CompilerDeclContext *parent_decl_ctx, size_t max_matches, TypeList &type_list); @@ -816,10 +807,9 @@ public: /// /// @see SymbolContext::Scope //------------------------------------------------------------------ - uint32_t - ResolveSymbolContextForAddress(const Address &so_addr, uint32_t resolve_scope, - SymbolContext &sc, - bool resolve_tail_call_address = false); + uint32_t ResolveSymbolContextForAddress( + const Address &so_addr, lldb::SymbolContextItem resolve_scope, + SymbolContext &sc, bool resolve_tail_call_address = false); //------------------------------------------------------------------ /// Resolve items in the symbol context for a given file and line. @@ -862,10 +852,9 @@ public: /// /// @see SymbolContext::Scope //------------------------------------------------------------------ - uint32_t ResolveSymbolContextForFilePath(const char *file_path, uint32_t line, - bool check_inlines, - uint32_t resolve_scope, - SymbolContextList &sc_list); + uint32_t ResolveSymbolContextForFilePath( + const char *file_path, uint32_t line, bool check_inlines, + lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list); //------------------------------------------------------------------ /// Resolve items in the symbol context for a given file and line. @@ -909,10 +898,9 @@ public: /// /// @see SymbolContext::Scope //------------------------------------------------------------------ - uint32_t ResolveSymbolContextsForFileSpec(const FileSpec &file_spec, - uint32_t line, bool check_inlines, - uint32_t resolve_scope, - SymbolContextList &sc_list); + uint32_t ResolveSymbolContextsForFileSpec( + const FileSpec &file_spec, uint32_t line, bool check_inlines, + lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list); void SetFileSpecAndObjectName(const FileSpec &file, const ConstString &object_name); @@ -1031,9 +1019,10 @@ public: public: LookupInfo() : m_name(), m_lookup_name(), m_language(lldb::eLanguageTypeUnknown), - m_name_type_mask(0), m_match_name_after_lookup(false) {} + m_name_type_mask(lldb::eFunctionNameTypeNone), + m_match_name_after_lookup(false) {} - LookupInfo(const ConstString &name, uint32_t name_type_mask, + LookupInfo(const ConstString &name, lldb::FunctionNameType name_type_mask, lldb::LanguageType language); const ConstString &GetName() const { return m_name; } @@ -1044,24 +1033,31 @@ public: void SetLookupName(const ConstString &name) { m_lookup_name = name; } - uint32_t GetNameTypeMask() const { return m_name_type_mask; } + lldb::FunctionNameType GetNameTypeMask() const { return m_name_type_mask; } - void SetNameTypeMask(uint32_t mask) { m_name_type_mask = mask; } + void SetNameTypeMask(lldb::FunctionNameType mask) { + m_name_type_mask = mask; + } void Prune(SymbolContextList &sc_list, size_t start_idx) const; protected: - ConstString m_name; ///< What the user originally typed - ConstString m_lookup_name; ///< The actual name will lookup when calling in - ///the object or symbol file - lldb::LanguageType - m_language; ///< Limit matches to only be for this language - uint32_t m_name_type_mask; ///< One or more bits from lldb::FunctionNameType - ///that indicate what kind of names we are - ///looking for - bool m_match_name_after_lookup; ///< If \b true, then demangled names that - ///match will need to contain "m_name" in - ///order to be considered a match + /// What the user originally typed + ConstString m_name; + + /// The actual name will lookup when calling in the object or symbol file + ConstString m_lookup_name; + + /// Limit matches to only be for this language + lldb::LanguageType m_language; + + /// One or more bits from lldb::FunctionNameType that indicate what kind of + /// names we are looking for + lldb::FunctionNameType m_name_type_mask; + + ///< If \b true, then demangled names that match will need to contain + ///< "m_name" in order to be considered a match + bool m_match_name_after_lookup; }; protected: @@ -1155,7 +1151,7 @@ protected: //------------------------------------------------------------------ uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr, bool vm_addr_is_file_addr, - uint32_t resolve_scope, + lldb::SymbolContextItem resolve_scope, Address &so_addr, SymbolContext &sc); void SymbolIndicesToSymbolContextList(Symtab *symtab, @@ -1176,9 +1172,8 @@ private: Module(); // Only used internally by CreateJITModule () size_t FindTypes_Impl( - const SymbolContext &sc, const ConstString &name, - const CompilerDeclContext *parent_decl_ctx, bool append, - size_t max_matches, + const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + bool append, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types); diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h index e1d8a9a7fb85..a28d97113d63 100644 --- a/include/lldb/Core/ModuleList.h +++ b/include/lldb/Core/ModuleList.h @@ -10,12 +10,12 @@ #ifndef liblldb_ModuleList_h_ #define liblldb_ModuleList_h_ -#include "lldb/Core/Address.h" // for Address -#include "lldb/Core/ModuleSpec.h" // for ModuleSpec +#include "lldb/Core/Address.h" +#include "lldb/Core/ModuleSpec.h" #include "lldb/Core/UserSettingsController.h" -#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Iterable.h" -#include "lldb/Utility/Status.h" // for Status +#include "lldb/Utility/Status.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" @@ -27,8 +27,8 @@ #include <mutex> #include <vector> -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class ConstString; @@ -300,14 +300,16 @@ public: //------------------------------------------------------------------ /// @see Module::FindFunctions () //------------------------------------------------------------------ - size_t FindFunctions(const ConstString &name, uint32_t name_type_mask, + size_t FindFunctions(const ConstString &name, + lldb::FunctionNameType name_type_mask, bool include_symbols, bool include_inlines, bool append, SymbolContextList &sc_list) const; //------------------------------------------------------------------ /// @see Module::FindFunctionSymbols () //------------------------------------------------------------------ - size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask, + size_t FindFunctionSymbols(const ConstString &name, + lldb::FunctionNameType name_type_mask, SymbolContextList &sc_list); //------------------------------------------------------------------ @@ -415,9 +417,9 @@ public: //------------------------------------------------------------------ /// Find types by name. /// - /// @param[in] sc - /// A symbol context that scopes where to extract a type list - /// from. + /// @param[in] search_first + /// If non-null, this module will be searched before any other + /// modules. /// /// @param[in] name /// The name of the type we are looking for. @@ -445,7 +447,7 @@ public: /// @return /// The number of matches added to \a type_list. //------------------------------------------------------------------ - size_t FindTypes(const SymbolContext &sc, const ConstString &name, + size_t FindTypes(Module *search_first, const ConstString &name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files, TypeList &types) const; @@ -495,26 +497,24 @@ public: /// &,uint32_t,SymbolContext&) //------------------------------------------------------------------ uint32_t ResolveSymbolContextForAddress(const Address &so_addr, - uint32_t resolve_scope, + lldb::SymbolContextItem resolve_scope, SymbolContext &sc) const; //------------------------------------------------------------------ /// @copydoc Module::ResolveSymbolContextForFilePath (const char /// *,uint32_t,bool,uint32_t,SymbolContextList&) //------------------------------------------------------------------ - uint32_t ResolveSymbolContextForFilePath(const char *file_path, uint32_t line, - bool check_inlines, - uint32_t resolve_scope, - SymbolContextList &sc_list) const; + uint32_t ResolveSymbolContextForFilePath( + const char *file_path, uint32_t line, bool check_inlines, + lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const; //------------------------------------------------------------------ /// @copydoc Module::ResolveSymbolContextsForFileSpec (const FileSpec /// &,uint32_t,bool,uint32_t,SymbolContextList&) //------------------------------------------------------------------ - uint32_t ResolveSymbolContextsForFileSpec(const FileSpec &file_spec, - uint32_t line, bool check_inlines, - uint32_t resolve_scope, - SymbolContextList &sc_list) const; + uint32_t ResolveSymbolContextsForFileSpec( + const FileSpec &file_spec, uint32_t line, bool check_inlines, + lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const; //------------------------------------------------------------------ /// Gets the size of the module list. diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h index 16a35a187780..ae772c2a1efe 100644 --- a/include/lldb/Core/ModuleSpec.h +++ b/include/lldb/Core/ModuleSpec.h @@ -10,18 +10,15 @@ #ifndef liblldb_ModuleSpec_h_ #define liblldb_ModuleSpec_h_ -// Project includes +#include "lldb/Host/FileSystem.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/ArchSpec.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" -// C Includes -// C++ Includes #include <mutex> #include <vector> @@ -34,15 +31,17 @@ public: m_object_name(), m_object_offset(0), m_object_size(0), m_source_mappings() {} - ModuleSpec(const FileSpec &file_spec, const UUID& uuid = UUID()) + ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID()) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(), m_uuid(uuid), m_object_name(), m_object_offset(0), - m_object_size(file_spec.GetByteSize()), m_source_mappings() {} + m_object_size(FileSystem::Instance().GetByteSize(file_spec)), + m_source_mappings() {} ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch) : m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch), m_uuid(), m_object_name(), m_object_offset(0), - m_object_size(file_spec.GetByteSize()), m_source_mappings() {} + m_object_size(FileSystem::Instance().GetByteSize(file_spec)), + m_source_mappings() {} ModuleSpec(const ModuleSpec &rhs) : m_file(rhs.m_file), m_platform_file(rhs.m_platform_file), @@ -256,20 +255,20 @@ public: if (match_module_spec.GetFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetFileSpec(); if (!FileSpec::Equal(fspec, GetFileSpec(), - fspec.GetDirectory().IsEmpty() == false)) + !fspec.GetDirectory().IsEmpty())) return false; } if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetPlatformFileSpec(); if (!FileSpec::Equal(fspec, GetPlatformFileSpec(), - fspec.GetDirectory().IsEmpty() == false)) + !fspec.GetDirectory().IsEmpty())) return false; } // Only match the symbol file spec if there is one in this ModuleSpec if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr()) { const FileSpec &fspec = match_module_spec.GetSymbolFileSpec(); if (!FileSpec::Equal(fspec, GetSymbolFileSpec(), - fspec.GetDirectory().IsEmpty() == false)) + !fspec.GetDirectory().IsEmpty())) return false; } if (match_module_spec.GetArchitecturePtr()) { diff --git a/include/lldb/Core/Opcode.h b/include/lldb/Core/Opcode.h index 33857457b2c4..fb6cc825abd2 100644 --- a/include/lldb/Core/Opcode.h +++ b/include/lldb/Core/Opcode.h @@ -11,12 +11,12 @@ #define lldb_Opcode_h #include "lldb/Utility/Endian.h" -#include "lldb/lldb-enumerations.h" // for ByteOrder, ByteOrder::eByteOrde... +#include "lldb/lldb-enumerations.h" #include "llvm/Support/MathExtras.h" -#include <assert.h> // for assert -#include <stdint.h> // for uint32_t, uint8_t, uint16_t +#include <assert.h> +#include <stdint.h> #include <string.h> namespace lldb_private { diff --git a/include/lldb/Core/PluginInterface.h b/include/lldb/Core/PluginInterface.h index edda15a1ace0..24f53c62ab09 100644 --- a/include/lldb/Core/PluginInterface.h +++ b/include/lldb/Core/PluginInterface.h @@ -10,10 +10,6 @@ #ifndef liblldb_PluginInterface_h_ #define liblldb_PluginInterface_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h index b782294f1f60..598ee9a8d8e3 100644 --- a/include/lldb/Core/PluginManager.h +++ b/include/lldb/Core/PluginManager.h @@ -12,14 +12,14 @@ #include "lldb/Core/Architecture.h" #include "lldb/Utility/FileSpec.h" -#include "lldb/Utility/Status.h" // for Status -#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 "lldb/Utility/Status.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-interfaces.h" +#include "llvm/ADT/StringRef.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class CommandInterpreter; diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h index 45bda26e2659..5a75a24f7f61 100644 --- a/include/lldb/Core/RangeMap.h +++ b/include/lldb/Core/RangeMap.h @@ -10,15 +10,11 @@ #ifndef liblldb_RangeMap_h_ #define liblldb_RangeMap_h_ -// C Includes -// C++ Includes #include <algorithm> #include <vector> -// Other libraries and framework includes #include "llvm/ADT/SmallVector.h" -// Project includes #include "lldb/lldb-private.h" // Uncomment to make sure all Range objects are sorted when needed @@ -169,8 +165,6 @@ public: #ifdef ASSERT_RANGEMAP_ARE_SORTED bool IsSorted() const { typename Collection::const_iterator pos, end, prev; - // First we determine if we can combine any of the Entry objects so we - // don't end up allocating and making a new collection for no reason for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++) { if (prev != end && *pos < *prev) @@ -639,201 +633,12 @@ struct RangeData : public Range<B, S> { } }; -template <typename B, typename S, typename T, unsigned N> class RangeDataArray { +template <typename B, typename S, typename T, unsigned N = 0> +class RangeDataVector { public: typedef RangeData<B, S, T> Entry; typedef llvm::SmallVector<Entry, N> Collection; - RangeDataArray() = default; - - ~RangeDataArray() = default; - - void Append(const Entry &entry) { m_entries.push_back(entry); } - - void Sort() { - if (m_entries.size() > 1) - std::stable_sort(m_entries.begin(), m_entries.end()); - } - -#ifdef ASSERT_RANGEMAP_ARE_SORTED - bool IsSorted() const { - typename Collection::const_iterator pos, end, prev; - // First we determine if we can combine any of the Entry objects so we - // don't end up allocating and making a new collection for no reason - for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; - prev = pos++) { - if (prev != end && *pos < *prev) - return false; - } - return true; - } -#endif - - void CombineConsecutiveEntriesWithEqualData() { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - typename Collection::iterator pos; - typename Collection::iterator end; - typename Collection::iterator prev; - bool can_combine = false; - // First we determine if we can combine any of the Entry objects so we - // don't end up allocating and making a new collection for no reason - for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; - prev = pos++) { - if (prev != end && prev->data == pos->data) { - can_combine = true; - break; - } - } - - // We we can combine at least one entry, then we make a new collection and - // populate it accordingly, and then swap it into place. - if (can_combine) { - Collection minimal_ranges; - for (pos = m_entries.begin(), end = m_entries.end(), prev = end; - pos != end; prev = pos++) { - if (prev != end && prev->data == pos->data) - minimal_ranges.back().SetRangeEnd(pos->GetRangeEnd()); - else - minimal_ranges.push_back(*pos); - } - // Use the swap technique in case our new vector is much smaller. We must - // swap when using the STL because std::vector objects never release or - // reduce the memory once it has been allocated/reserved. - m_entries.swap(minimal_ranges); - } - } - - void Clear() { m_entries.clear(); } - - bool IsEmpty() const { return m_entries.empty(); } - - size_t GetSize() const { return m_entries.size(); } - - const Entry *GetEntryAtIndex(size_t i) const { - return ((i < m_entries.size()) ? &m_entries[i] : nullptr); - } - - // Clients must ensure that "i" is a valid index prior to calling this - // function - const Entry &GetEntryRef(size_t i) const { return m_entries[i]; } - - static bool BaseLessThan(const Entry &lhs, const Entry &rhs) { - return lhs.GetRangeBase() < rhs.GetRangeBase(); - } - - uint32_t FindEntryIndexThatContains(B addr) const { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - if (!m_entries.empty()) { - Entry entry(addr, 1); - typename Collection::const_iterator begin = m_entries.begin(); - typename Collection::const_iterator end = m_entries.end(); - typename Collection::const_iterator pos = - std::lower_bound(begin, end, entry, BaseLessThan); - - if (pos != end && pos->Contains(addr)) { - return std::distance(begin, pos); - } else if (pos != begin) { - --pos; - if (pos->Contains(addr)) - return std::distance(begin, pos); - } - } - return UINT32_MAX; - } - - Entry *FindEntryThatContains(B addr) { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - if (!m_entries.empty()) { - Entry entry; - entry.SetRangeBase(addr); - entry.SetByteSize(1); - typename Collection::iterator begin = m_entries.begin(); - typename Collection::iterator end = m_entries.end(); - typename Collection::iterator pos = - std::lower_bound(begin, end, entry, BaseLessThan); - - if (pos != end && pos->Contains(addr)) { - return &(*pos); - } else if (pos != begin) { - --pos; - if (pos->Contains(addr)) { - return &(*pos); - } - } - } - return nullptr; - } - - const Entry *FindEntryThatContains(B addr) const { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - if (!m_entries.empty()) { - Entry entry; - entry.SetRangeBase(addr); - entry.SetByteSize(1); - typename Collection::const_iterator begin = m_entries.begin(); - typename Collection::const_iterator end = m_entries.end(); - typename Collection::const_iterator pos = - std::lower_bound(begin, end, entry, BaseLessThan); - - if (pos != end && pos->Contains(addr)) { - return &(*pos); - } else if (pos != begin) { - --pos; - if (pos->Contains(addr)) { - return &(*pos); - } - } - } - return nullptr; - } - - const Entry *FindEntryThatContains(const Entry &range) const { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - if (!m_entries.empty()) { - typename Collection::const_iterator begin = m_entries.begin(); - typename Collection::const_iterator end = m_entries.end(); - typename Collection::const_iterator pos = - std::lower_bound(begin, end, range, BaseLessThan); - - if (pos != end && pos->Contains(range)) { - return &(*pos); - } else if (pos != begin) { - --pos; - if (pos->Contains(range)) { - return &(*pos); - } - } - } - return nullptr; - } - - Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); } - - const Entry *Back() const { - return (m_entries.empty() ? nullptr : &m_entries.back()); - } - -protected: - Collection m_entries; -}; - -// Same as RangeDataArray, but uses std::vector as to not require static -// storage of N items in the class itself -template <typename B, typename S, typename T> class RangeDataVector { -public: - typedef RangeData<B, S, T> Entry; - typedef std::vector<Entry> Collection; - RangeDataVector() = default; ~RangeDataVector() = default; @@ -895,38 +700,8 @@ public: } } - // Calculate the byte size of ranges with zero byte sizes by finding the next - // entry with a base address > the current base address - void CalculateSizesOfZeroByteSizeRanges(S full_size = 0) { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - typename Collection::iterator pos; - typename Collection::iterator end; - typename Collection::iterator next; - for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos) { - if (pos->GetByteSize() == 0) { - // Watch out for multiple entries with same address and make sure we - // find an entry that is greater than the current base address before - // we use that for the size - auto curr_base = pos->GetRangeBase(); - for (next = pos + 1; next != end; ++next) { - auto next_base = next->GetRangeBase(); - if (next_base > curr_base) { - pos->SetByteSize(next_base - curr_base); - break; - } - } - if (next == end && full_size > curr_base) - pos->SetByteSize(full_size - curr_base); - } - } - } - void Clear() { m_entries.clear(); } - void Reserve(typename Collection::size_type size) { m_entries.resize(size); } - bool IsEmpty() const { return m_entries.empty(); } size_t GetSize() const { return m_entries.size(); } @@ -948,22 +723,9 @@ public: } uint32_t FindEntryIndexThatContains(B addr) const { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - if (!m_entries.empty()) { - Entry entry(addr, 1); - typename Collection::const_iterator begin = m_entries.begin(); - typename Collection::const_iterator end = m_entries.end(); - typename Collection::const_iterator pos = - std::lower_bound(begin, end, entry, BaseLessThan); - - while (pos != begin && pos[-1].Contains(addr)) - --pos; - - if (pos != end && pos->Contains(addr)) - return std::distance(begin, pos); - } + const Entry *entry = FindEntryThatContains(addr); + if (entry) + return std::distance(m_entries.begin(), entry); return UINT32_MAX; } @@ -983,47 +745,13 @@ public: } Entry *FindEntryThatContains(B addr) { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - if (!m_entries.empty()) { - Entry entry; - entry.SetRangeBase(addr); - entry.SetByteSize(1); - typename Collection::iterator begin = m_entries.begin(); - typename Collection::iterator end = m_entries.end(); - typename Collection::iterator pos = - std::lower_bound(begin, end, entry, BaseLessThan); - - while (pos != begin && pos[-1].Contains(addr)) - --pos; - - if (pos != end && pos->Contains(addr)) - return &(*pos); - } - return nullptr; + return const_cast<Entry *>( + static_cast<const RangeDataVector *>(this)->FindEntryThatContains( + addr)); } const Entry *FindEntryThatContains(B addr) const { -#ifdef ASSERT_RANGEMAP_ARE_SORTED - assert(IsSorted()); -#endif - if (!m_entries.empty()) { - Entry entry; - entry.SetRangeBase(addr); - entry.SetByteSize(1); - typename Collection::const_iterator begin = m_entries.begin(); - typename Collection::const_iterator end = m_entries.end(); - typename Collection::const_iterator pos = - std::lower_bound(begin, end, entry, BaseLessThan); - - while (pos != begin && pos[-1].Contains(addr)) - --pos; - - if (pos != end && pos->Contains(addr)) - return &(*pos); - } - return nullptr; + return FindEntryThatContains(Entry(addr, 1)); } const Entry *FindEntryThatContains(const Entry &range) const { diff --git a/include/lldb/Core/RegisterValue.h b/include/lldb/Core/RegisterValue.h deleted file mode 100644 index b369c3dff9a9..000000000000 --- a/include/lldb/Core/RegisterValue.h +++ /dev/null @@ -1,279 +0,0 @@ -//===-- RegisterValue.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_RegisterValue_h -#define lldb_RegisterValue_h - -#include "lldb/Core/Scalar.h" -#include "lldb/Utility/Endian.h" -#include "lldb/Utility/Status.h" // for Status -#include "lldb/lldb-enumerations.h" // for ByteOrder, Format -#include "lldb/lldb-types.h" // for offset_t - -#include "llvm/ADT/APInt.h" -#include "llvm/ADT/StringRef.h" // for StringRef - -#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: - enum { kMaxRegisterByteSize = 64u }; - - enum Type { - eTypeInvalid, - eTypeUInt8, - eTypeUInt16, - eTypeUInt32, - eTypeUInt64, - eTypeUInt128, - eTypeFloat, - eTypeDouble, - eTypeLongDouble, - eTypeBytes - }; - - RegisterValue() : m_type(eTypeInvalid), m_scalar((unsigned long)0) {} - - explicit RegisterValue(uint8_t inst) : m_type(eTypeUInt8) { m_scalar = inst; } - - explicit RegisterValue(uint16_t inst) : m_type(eTypeUInt16) { - m_scalar = inst; - } - - explicit RegisterValue(uint32_t inst) : m_type(eTypeUInt32) { - m_scalar = inst; - } - - explicit RegisterValue(uint64_t inst) : m_type(eTypeUInt64) { - m_scalar = inst; - } - - explicit RegisterValue(llvm::APInt inst) : m_type(eTypeUInt128) { - m_scalar = llvm::APInt(inst); - } - - explicit RegisterValue(float value) : m_type(eTypeFloat) { m_scalar = value; } - - explicit RegisterValue(double value) : m_type(eTypeDouble) { - m_scalar = value; - } - - explicit RegisterValue(long double value) : m_type(eTypeLongDouble) { - m_scalar = value; - } - - explicit RegisterValue(uint8_t *bytes, size_t length, - lldb::ByteOrder byte_order) { - SetBytes(bytes, length, byte_order); - } - - RegisterValue::Type GetType() const { return m_type; } - - bool CopyValue(const RegisterValue &rhs); - - void SetType(RegisterValue::Type type) { m_type = type; } - - RegisterValue::Type SetType(const RegisterInfo *reg_info); - - bool GetData(DataExtractor &data) const; - - // Copy the register value from this object into a buffer in "dst" and obey - // the "dst_byte_order" when copying the data. Also watch out in case - // "dst_len" is longer or shorter than the register value described by - // "reg_info" and only copy the least significant bytes of the register - // value, or pad the destination with zeroes if the register byte size is - // shorter that "dst_len" (all while correctly abiding the "dst_byte_order"). - // Returns the number of bytes copied into "dst". - uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst, - uint32_t dst_len, lldb::ByteOrder dst_byte_order, - Status &error) const; - - uint32_t SetFromMemoryData(const RegisterInfo *reg_info, const void *src, - uint32_t src_len, lldb::ByteOrder src_byte_order, - Status &error); - - bool GetScalarValue(Scalar &scalar) const; - - uint8_t GetAsUInt8(uint8_t fail_value = UINT8_MAX, - bool *success_ptr = nullptr) const { - if (m_type == eTypeUInt8) { - if (success_ptr) - *success_ptr = true; - return m_scalar.UChar(fail_value); - } - if (success_ptr) - *success_ptr = true; - return fail_value; - } - - uint16_t GetAsUInt16(uint16_t fail_value = UINT16_MAX, - bool *success_ptr = nullptr) const; - - uint32_t GetAsUInt32(uint32_t fail_value = UINT32_MAX, - bool *success_ptr = nullptr) const; - - uint64_t GetAsUInt64(uint64_t fail_value = UINT64_MAX, - bool *success_ptr = nullptr) const; - - llvm::APInt GetAsUInt128(const llvm::APInt &fail_value, - bool *success_ptr = nullptr) const; - - float GetAsFloat(float fail_value = 0.0f, bool *success_ptr = nullptr) const; - - double GetAsDouble(double fail_value = 0.0, - bool *success_ptr = nullptr) const; - - long double GetAsLongDouble(long double fail_value = 0.0, - bool *success_ptr = nullptr) const; - - void SetValueToInvalid() { m_type = eTypeInvalid; } - - bool ClearBit(uint32_t bit); - - bool SetBit(uint32_t bit); - - bool operator==(const RegisterValue &rhs) const; - - bool operator!=(const RegisterValue &rhs) const; - - void operator=(uint8_t uint) { - m_type = eTypeUInt8; - m_scalar = uint; - } - - void operator=(uint16_t uint) { - m_type = eTypeUInt16; - m_scalar = uint; - } - - void operator=(uint32_t uint) { - m_type = eTypeUInt32; - m_scalar = uint; - } - - void operator=(uint64_t uint) { - m_type = eTypeUInt64; - m_scalar = uint; - } - - void operator=(llvm::APInt uint) { - m_type = eTypeUInt128; - m_scalar = llvm::APInt(uint); - } - - void operator=(float f) { - m_type = eTypeFloat; - m_scalar = f; - } - - void operator=(double f) { - m_type = eTypeDouble; - m_scalar = f; - } - - void operator=(long double f) { - m_type = eTypeLongDouble; - m_scalar = f; - } - - void SetUInt8(uint8_t uint) { - m_type = eTypeUInt8; - m_scalar = uint; - } - - void SetUInt16(uint16_t uint) { - m_type = eTypeUInt16; - m_scalar = uint; - } - - void SetUInt32(uint32_t uint, Type t = eTypeUInt32) { - m_type = t; - m_scalar = uint; - } - - void SetUInt64(uint64_t uint, Type t = eTypeUInt64) { - m_type = t; - m_scalar = uint; - } - - void SetUInt128(llvm::APInt uint) { - m_type = eTypeUInt128; - m_scalar = uint; - } - - bool SetUInt(uint64_t uint, uint32_t byte_size); - - void SetFloat(float f) { - m_type = eTypeFloat; - m_scalar = f; - } - - void SetDouble(double f) { - m_type = eTypeDouble; - m_scalar = f; - } - - void SetLongDouble(long double f) { - m_type = eTypeLongDouble; - m_scalar = f; - } - - void SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order); - - bool SignExtend(uint32_t sign_bitpos); - - Status SetValueFromString(const RegisterInfo *reg_info, - llvm::StringRef value_str); - Status SetValueFromString(const RegisterInfo *reg_info, - const char *value_str) = delete; - - Status SetValueFromData(const RegisterInfo *reg_info, DataExtractor &data, - lldb::offset_t offset, bool partial_data_ok); - - const void *GetBytes() const; - - lldb::ByteOrder GetByteOrder() const { - if (m_type == eTypeBytes) - return buffer.byte_order; - return endian::InlHostByteOrder(); - } - - uint32_t GetByteSize() const; - - static uint32_t GetMaxByteSize() { return kMaxRegisterByteSize; } - - void Clear(); - -protected: - RegisterValue::Type m_type; - Scalar m_scalar; - - struct { - uint8_t bytes[kMaxRegisterByteSize]; // This must be big enough to hold any - // register for any supported target. - uint8_t length; - lldb::ByteOrder byte_order; - } buffer; -}; - -} // namespace lldb_private - -#endif // lldb_RegisterValue_h diff --git a/include/lldb/Core/RichManglingContext.h b/include/lldb/Core/RichManglingContext.h new file mode 100644 index 000000000000..30841bfb2668 --- /dev/null +++ b/include/lldb/Core/RichManglingContext.h @@ -0,0 +1,108 @@ +//===-- RichManglingContext.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_RichManglingContext_h_ +#define liblldb_RichManglingContext_h_ + +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private.h" + +#include "lldb/Utility/ConstString.h" + +#include "llvm/ADT/Any.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/Demangle/Demangle.h" + +namespace lldb_private { + +/// Uniform wrapper for access to rich mangling information from different +/// providers. See Mangled::DemangleWithRichManglingInfo() +class RichManglingContext { +public: + RichManglingContext() : m_provider(None), m_ipd_buf_size(2048) { + m_ipd_buf = static_cast<char *>(std::malloc(m_ipd_buf_size)); + m_ipd_buf[0] = '\0'; + } + + ~RichManglingContext() { std::free(m_ipd_buf); } + + /// Use the ItaniumPartialDemangler to obtain rich mangling information from + /// the given mangled name. + bool FromItaniumName(const ConstString &mangled); + + /// Use the legacy language parser implementation to obtain rich mangling + /// information from the given demangled name. + bool FromCxxMethodName(const ConstString &demangled); + + /// If this symbol describes a constructor or destructor. + bool IsCtorOrDtor() const; + + /// If this symbol describes a function. + bool IsFunction() const; + + /// Get the base name of a function. This doesn't include trailing template + /// arguments, ie "a::b<int>" gives "b". The result will overwrite the + /// internal buffer. It can be obtained via GetBufferRef(). + void ParseFunctionBaseName(); + + /// Get the context name for a function. For "a::b::c", this function returns + /// "a::b". The result will overwrite the internal buffer. It can be obtained + /// via GetBufferRef(). + void ParseFunctionDeclContextName(); + + /// Get the entire demangled name. The result will overwrite the internal + /// buffer. It can be obtained via GetBufferRef(). + void ParseFullName(); + + /// Obtain a StringRef to the internal buffer that holds the result of the + /// most recent ParseXy() operation. The next ParseXy() call invalidates it. + llvm::StringRef GetBufferRef() const { + assert(m_provider != None && "Initialize a provider first"); + return m_buffer; + } + +private: + enum InfoProvider { None, ItaniumPartialDemangler, PluginCxxLanguage }; + + /// Selects the rich mangling info provider. + InfoProvider m_provider; + + /// Reference to the buffer used for results of ParseXy() operations. + llvm::StringRef m_buffer; + + /// Members for ItaniumPartialDemangler + llvm::ItaniumPartialDemangler m_ipd; + char *m_ipd_buf; + size_t m_ipd_buf_size; + + /// Members for PluginCxxLanguage + /// Cannot forward declare inner class CPlusPlusLanguage::MethodName. The + /// respective header is in Plugins and including it from here causes cyclic + /// dependency. Instead keep a llvm::Any and cast it on-access in the cpp. + llvm::Any m_cxx_method_parser; + + /// Clean up memory and set a new info provider for this instance. + void ResetProvider(InfoProvider new_provider); + + /// Uniform handling of string buffers for ItaniumPartialDemangler. + void processIPDStrResult(char *ipd_res, size_t res_len); + + /// Cast the given parser to the given type. Ideally we would have a type + /// trait to deduce \a ParserT from a given InfoProvider, but unfortunately we + /// can't access CPlusPlusLanguage::MethodName from within the header. + template <class ParserT> static ParserT *get(llvm::Any parser) { + assert(parser.hasValue()); + assert(llvm::any_isa<ParserT *>(parser)); + return llvm::any_cast<ParserT *>(parser); + } +}; + +} // namespace lldb_private + +#endif diff --git a/include/lldb/Core/STLUtils.h b/include/lldb/Core/STLUtils.h index 55f1ac05c975..0ed354fa4e32 100644 --- a/include/lldb/Core/STLUtils.h +++ b/include/lldb/Core/STLUtils.h @@ -10,16 +10,12 @@ #ifndef liblldb_STLUtils_h_ #define liblldb_STLUtils_h_ -// C Includes #include <string.h> -// C++ Includes #include <map> #include <ostream> #include <vector> -// Other libraries and framework includes -// Project includes //---------------------------------------------------------------------- // C string less than compare function object diff --git a/include/lldb/Core/Scalar.h b/include/lldb/Core/Scalar.h deleted file mode 100644 index 40671a242ec3..000000000000 --- a/include/lldb/Core/Scalar.h +++ /dev/null @@ -1,378 +0,0 @@ -//===-- Scalar.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_Scalar_h_ -#define liblldb_Scalar_h_ - -#include "lldb/Utility/Status.h" // for Status -#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 -#define BITWIDTH_INT256 256 - -namespace lldb_private { - -//---------------------------------------------------------------------- -// A class designed to hold onto values and their corresponding types. -// Operators are defined and Scalar objects will correctly promote their types -// and values before performing these operations. Type promotion currently -// follows the ANSI C type promotion rules. -//---------------------------------------------------------------------- -class Scalar { -public: - enum Type { - e_void = 0, - e_sint, - e_uint, - e_slong, - e_ulong, - e_slonglong, - e_ulonglong, - e_sint128, - e_uint128, - e_sint256, - e_uint256, - e_float, - e_double, - e_long_double - }; - - //------------------------------------------------------------------ - // Constructors and Destructors - //------------------------------------------------------------------ - Scalar(); - Scalar(int v) : m_type(e_sint), m_float((float)0) { - m_integer = llvm::APInt(sizeof(int) * 8, v, true); - } - Scalar(unsigned int v) : m_type(e_uint), m_float((float)0) { - m_integer = llvm::APInt(sizeof(int) * 8, v); - } - Scalar(long v) : m_type(e_slong), m_float((float)0) { - m_integer = llvm::APInt(sizeof(long) * 8, v, true); - } - Scalar(unsigned long v) : m_type(e_ulong), m_float((float)0) { - m_integer = llvm::APInt(sizeof(long) * 8, v); - } - Scalar(long long v) : m_type(e_slonglong), m_float((float)0) { - m_integer = llvm::APInt(sizeof(long long) * 8, v, true); - } - Scalar(unsigned long long v) : m_type(e_ulonglong), m_float((float)0) { - m_integer = llvm::APInt(sizeof(long long) * 8, v); - } - Scalar(float v) : m_type(e_float), m_float(v) { m_float = llvm::APFloat(v); } - Scalar(double v) : m_type(e_double), m_float(v) { - m_float = llvm::APFloat(v); - } - Scalar(long double v, bool ieee_quad) - : m_type(e_long_double), m_float((float)0), m_ieee_quad(ieee_quad) { - if (ieee_quad) - m_float = llvm::APFloat(llvm::APFloat::IEEEquad(), - llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, - ((type128 *)&v)->x)); - else - m_float = llvm::APFloat(llvm::APFloat::x87DoubleExtended(), - llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, - ((type128 *)&v)->x)); - } - Scalar(llvm::APInt v) : m_type(), m_float((float)0) { - m_integer = llvm::APInt(v); - switch (m_integer.getBitWidth()) { - case 8: - case 16: - case 32: - if (m_integer.isSignedIntN(sizeof(sint_t) * 8)) - m_type = e_sint; - else - m_type = e_uint; - break; - case 64: - if (m_integer.isSignedIntN(sizeof(slonglong_t) * 8)) - m_type = e_slonglong; - else - m_type = e_ulonglong; - break; - case 128: - if (m_integer.isSignedIntN(BITWIDTH_INT128)) - m_type = e_sint128; - else - m_type = e_uint128; - break; - case 256: - if (m_integer.isSignedIntN(BITWIDTH_INT256)) - m_type = e_sint256; - else - m_type = e_uint256; - break; - } - } - Scalar(const Scalar &rhs); - // Scalar(const RegisterValue& reg_value); - virtual ~Scalar(); - - bool SignExtend(uint32_t bit_pos); - - bool ExtractBitfield(uint32_t bit_size, uint32_t bit_offset); - - bool SetBit(uint32_t bit); - - bool ClearBit(uint32_t bit); - - const void *GetBytes() const; - - size_t GetByteSize() const; - - bool GetData(DataExtractor &data, size_t limit_byte_size = UINT32_MAX) const; - - size_t GetAsMemoryData(void *dst, size_t dst_len, - lldb::ByteOrder dst_byte_order, Status &error) const; - - bool IsZero() const; - - void Clear() { - m_type = e_void; - m_integer.clearAllBits(); - } - - const char *GetTypeAsCString() const; - - void GetValue(Stream *s, bool show_type) const; - - bool IsValid() const { - return (m_type >= e_sint) && (m_type <= e_long_double); - } - - bool Promote(Scalar::Type type); - - bool MakeSigned(); - - bool MakeUnsigned(); - - static const char *GetValueTypeAsCString(Scalar::Type value_type); - - static Scalar::Type - GetValueTypeForSignedIntegerWithByteSize(size_t byte_size); - - static Scalar::Type - GetValueTypeForUnsignedIntegerWithByteSize(size_t byte_size); - - static Scalar::Type GetValueTypeForFloatWithByteSize(size_t byte_size); - - //---------------------------------------------------------------------- - // All operators can benefits from the implicit conversions that will happen - // automagically by the compiler, so no temporary objects will need to be - // created. As a result, we currently don't need a variety of overloaded set - // value accessors. - //---------------------------------------------------------------------- - Scalar &operator=(const int i); - Scalar &operator=(unsigned int v); - Scalar &operator=(long v); - Scalar &operator=(unsigned long v); - Scalar &operator=(long long v); - Scalar &operator=(unsigned long long v); - Scalar &operator=(float v); - Scalar &operator=(double v); - Scalar &operator=(long double v); - Scalar &operator=(llvm::APInt v); - Scalar &operator=(const Scalar &rhs); // Assignment operator - Scalar &operator+=(const Scalar &rhs); - Scalar &operator<<=(const Scalar &rhs); // Shift left - Scalar &operator>>=(const Scalar &rhs); // Shift right (arithmetic) - Scalar &operator&=(const Scalar &rhs); - - //---------------------------------------------------------------------- - // Shifts the current value to the right without maintaining the current sign - // of the value (if it is signed). - //---------------------------------------------------------------------- - bool ShiftRightLogical(const Scalar &rhs); // Returns true on success - - //---------------------------------------------------------------------- - // Takes the absolute value of the current value if it is signed, else the - // value remains unchanged. Returns false if the contained value has a void - // type. - //---------------------------------------------------------------------- - bool AbsoluteValue(); // Returns true on success - //---------------------------------------------------------------------- - // Negates the current value (even for unsigned values). Returns false if the - // contained value has a void type. - //---------------------------------------------------------------------- - bool UnaryNegate(); // Returns true on success - //---------------------------------------------------------------------- - // Inverts all bits in the current value as long as it isn't void or a - // float/double/long double type. Returns false if the contained value has a - // void/float/double/long double type, else the value is inverted and true is - // returned. - //---------------------------------------------------------------------- - bool OnesComplement(); // Returns true on success - - //---------------------------------------------------------------------- - // Access the type of the current value. - //---------------------------------------------------------------------- - Scalar::Type GetType() const { return m_type; } - - //---------------------------------------------------------------------- - // Returns a casted value of the current contained data without modifying the - // current value. FAIL_VALUE will be returned if the type of the value is - // void or invalid. - //---------------------------------------------------------------------- - int SInt(int fail_value = 0) const; - - unsigned char UChar(unsigned char fail_value = 0) const; - - signed char SChar(char fail_value = 0) const; - - unsigned short UShort(unsigned short fail_value = 0) const; - - short SShort(short fail_value = 0) const; - - unsigned int UInt(unsigned int fail_value = 0) const; - - long SLong(long fail_value = 0) const; - - unsigned long ULong(unsigned long fail_value = 0) const; - - long long SLongLong(long long fail_value = 0) const; - - unsigned long long ULongLong(unsigned long long fail_value = 0) const; - - llvm::APInt SInt128(llvm::APInt &fail_value) const; - - llvm::APInt UInt128(const llvm::APInt &fail_value) const; - - llvm::APInt SInt256(llvm::APInt &fail_value) const; - - llvm::APInt UInt256(const llvm::APInt &fail_value) const; - - float Float(float fail_value = 0.0f) const; - - double Double(double fail_value = 0.0) const; - - long double LongDouble(long double fail_value = 0.0) const; - - Status SetValueFromCString(const char *s, lldb::Encoding encoding, - size_t byte_size); - - Status SetValueFromData(DataExtractor &data, lldb::Encoding encoding, - size_t byte_size); - - static bool UIntValueIsValidForSize(uint64_t uval64, size_t total_byte_size) { - if (total_byte_size > 8) - return false; - - if (total_byte_size == 8) - return true; - - const uint64_t max = ((uint64_t)1 << (uint64_t)(total_byte_size * 8)) - 1; - return uval64 <= max; - } - - static bool SIntValueIsValidForSize(int64_t sval64, size_t total_byte_size) { - if (total_byte_size > 8) - return false; - - if (total_byte_size == 8) - return true; - - const int64_t max = ((int64_t)1 << (uint64_t)(total_byte_size * 8 - 1)) - 1; - const int64_t min = ~(max); - return min <= sval64 && sval64 <= max; - } - -protected: - typedef char schar_t; - typedef unsigned char uchar_t; - typedef short sshort_t; - typedef unsigned short ushort_t; - typedef int sint_t; - typedef unsigned int uint_t; - typedef long slong_t; - typedef unsigned long ulong_t; - typedef long long slonglong_t; - typedef unsigned long long ulonglong_t; - typedef float float_t; - typedef double double_t; - typedef long double long_double_t; - - //------------------------------------------------------------------ - // Classes that inherit from Scalar can see and modify these - //------------------------------------------------------------------ - Scalar::Type m_type; - llvm::APInt m_integer; - llvm::APFloat m_float; - bool m_ieee_quad = false; - -private: - friend const Scalar operator+(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator-(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator/(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator*(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator&(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator|(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator%(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator^(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator<<(const Scalar &lhs, const Scalar &rhs); - friend const Scalar operator>>(const Scalar &lhs, const Scalar &rhs); - friend bool operator==(const Scalar &lhs, const Scalar &rhs); - friend bool operator!=(const Scalar &lhs, const Scalar &rhs); - friend bool operator<(const Scalar &lhs, const Scalar &rhs); - friend bool operator<=(const Scalar &lhs, const Scalar &rhs); - friend bool operator>(const Scalar &lhs, const Scalar &rhs); - friend bool operator>=(const Scalar &lhs, const Scalar &rhs); -}; - -//---------------------------------------------------------------------- -// Split out the operators into a format where the compiler will be able to -// implicitly convert numbers into Scalar objects. -// -// This allows code like: -// Scalar two(2); -// Scalar four = two * 2; -// Scalar eight = 2 * four; // This would cause an error if the -// // operator* was implemented as a -// // member function. -// SEE: -// Item 19 of "Effective C++ Second Edition" by Scott Meyers -// Differentiate among members functions, non-member functions, and -// friend functions -//---------------------------------------------------------------------- -const Scalar operator+(const Scalar &lhs, const Scalar &rhs); -const Scalar operator-(const Scalar &lhs, const Scalar &rhs); -const Scalar operator/(const Scalar &lhs, const Scalar &rhs); -const Scalar operator*(const Scalar &lhs, const Scalar &rhs); -const Scalar operator&(const Scalar &lhs, const Scalar &rhs); -const Scalar operator|(const Scalar &lhs, const Scalar &rhs); -const Scalar operator%(const Scalar &lhs, const Scalar &rhs); -const Scalar operator^(const Scalar &lhs, const Scalar &rhs); -const Scalar operator<<(const Scalar &lhs, const Scalar &rhs); -const Scalar operator>>(const Scalar &lhs, const Scalar &rhs); -bool operator==(const Scalar &lhs, const Scalar &rhs); -bool operator!=(const Scalar &lhs, const Scalar &rhs); -bool operator<(const Scalar &lhs, const Scalar &rhs); -bool operator<=(const Scalar &lhs, const Scalar &rhs); -bool operator>(const Scalar &lhs, const Scalar &rhs); -bool operator>=(const Scalar &lhs, const Scalar &rhs); - -} // namespace lldb_private - -#endif // liblldb_Scalar_h_ diff --git a/include/lldb/Core/SearchFilter.h b/include/lldb/Core/SearchFilter.h index 2e641983dc73..f53ef658fd3f 100644 --- a/include/lldb/Core/SearchFilter.h +++ b/include/lldb/Core/SearchFilter.h @@ -13,10 +13,10 @@ #include "lldb/Core/FileSpecList.h" #include "lldb/Utility/StructuredData.h" -#include "lldb/Utility/FileSpec.h" // for FileSpec -#include "lldb/lldb-forward.h" // for SearchFilterSP, TargetSP, Modu... +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-forward.h" -#include <stdint.h> // for uint32_t +#include <stdint.h> namespace lldb_private { class Address; @@ -70,15 +70,6 @@ public: eCallbackReturnPop // Pop one level up and continue iterating } CallbackReturn; - typedef enum { - eDepthTarget, - eDepthModule, - eDepthCompUnit, - eDepthFunction, - eDepthBlock, - eDepthAddress - } Depth; - Searcher(); virtual ~Searcher(); @@ -87,7 +78,7 @@ public: SymbolContext &context, Address *addr, bool complete) = 0; - virtual Depth GetDepth() = 0; + virtual lldb::SearchDepth GetDepth() = 0; //------------------------------------------------------------------ /// Prints a canonical description for the searcher to the stream \a s. @@ -193,6 +184,18 @@ public: virtual bool CompUnitPasses(CompileUnit &compUnit); //------------------------------------------------------------------ + /// Call this method with a Function to see if \a function passes the + /// filter. + /// + /// @param[in] function + /// The Functions to check against the filter. + /// + /// @return + /// \b true if \a function passes, and \b false otherwise. + //------------------------------------------------------------------ + virtual bool FunctionPasses(Function &function); + + //------------------------------------------------------------------ /// Call this method to do the search using the Searcher. /// /// @param[in] searcher diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h index 8e275ce3199e..4157bb877b4c 100644 --- a/include/lldb/Core/Section.h +++ b/include/lldb/Core/Section.h @@ -14,16 +14,16 @@ #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 "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" -#include <memory> // for enable_shared_from_this -#include <vector> // for vector +#include <memory> +#include <vector> -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, UINT32_MAX +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class Address; diff --git a/include/lldb/Core/SourceManager.h b/include/lldb/Core/SourceManager.h index ef652531244d..d31ba037c5d6 100644 --- a/include/lldb/Core/SourceManager.h +++ b/include/lldb/Core/SourceManager.h @@ -11,16 +11,16 @@ #define liblldb_SourceManager_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 +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" #include "llvm/Support/Chrono.h" -#include <cstdint> // for uint32_t, UINT32_MAX +#include <cstdint> #include <map> #include <memory> -#include <stddef.h> // for size_t -#include <string> // for string +#include <stddef.h> +#include <string> #include <vector> namespace lldb_private { @@ -52,7 +52,7 @@ public: void UpdateIfNeeded(); - size_t DisplaySourceLines(uint32_t line, uint32_t column, + size_t DisplaySourceLines(uint32_t line, llvm::Optional<size_t> column, uint32_t context_before, uint32_t context_after, Stream *s); void FindLinesMatchingRegex(RegularExpression ®ex, uint32_t start_line, diff --git a/include/lldb/Core/State.h b/include/lldb/Core/State.h deleted file mode 100644 index 68f0fee254b3..000000000000 --- a/include/lldb/Core/State.h +++ /dev/null @@ -1,85 +0,0 @@ -//===-- State.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_State_h_ -#define liblldb_State_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 { - -//------------------------------------------------------------------ -/// Converts a StateType to a C string. -/// -/// @param[in] state -/// The StateType object to convert. -/// -/// @return -/// A NULL terminated C string that describes \a state. The -/// returned string comes from constant string buffers and does -/// not need to be freed. -//------------------------------------------------------------------ -const char *StateAsCString(lldb::StateType state); - -//------------------------------------------------------------------ -/// Check if a state represents a state where the process or thread -/// is running. -/// -/// @param[in] state -/// The StateType enumeration value -/// -/// @return -/// \b true if the state represents a process or thread state -/// where the process or thread is running, \b false otherwise. -//------------------------------------------------------------------ -bool StateIsRunningState(lldb::StateType state); - -//------------------------------------------------------------------ -/// Check if a state represents a state where the process or thread -/// is stopped. Stopped can mean stopped when the process is still -/// around, or stopped when the process has exited or doesn't exist -/// yet. The \a must_exist argument tells us which of these cases is -/// desired. -/// -/// @param[in] state -/// The StateType enumeration value -/// -/// @param[in] must_exist -/// A boolean that indicates the thread must also be alive -/// so states like unloaded or exited won't return true. -/// -/// @return -/// \b true if the state represents a process or thread state -/// where the process or thread is stopped. If \a must_exist is -/// \b true, then the process can't be exited or unloaded, -/// otherwise exited and unloaded or other states where the -/// process no longer exists are considered to be stopped. -//------------------------------------------------------------------ -bool StateIsStoppedState(lldb::StateType state, bool must_exist); - -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 29b109757da7..89667be05878 100644 --- a/include/lldb/Core/StreamAsynchronousIO.h +++ b/include/lldb/Core/StreamAsynchronousIO.h @@ -14,7 +14,7 @@ #include <string> -#include <stddef.h> // for size_t +#include <stddef.h> namespace lldb_private { class Debugger; @@ -30,7 +30,8 @@ public: void Flush() override; - size_t Write(const void *src, size_t src_len) override; +protected: + size_t WriteImpl(const void *src, size_t src_len) override; private: Debugger &m_debugger; diff --git a/include/lldb/Core/StreamBuffer.h b/include/lldb/Core/StreamBuffer.h index 307dc7e18a5e..7b2468330ad2 100644 --- a/include/lldb/Core/StreamBuffer.h +++ b/include/lldb/Core/StreamBuffer.h @@ -30,12 +30,6 @@ public: // Nothing to do when flushing a buffer based stream... } - virtual size_t Write(const void *s, size_t length) { - if (s && length) - m_packet.append((const char *)s, ((const char *)s) + length); - return length; - } - void Clear() { m_packet.clear(); } // Beware, this might not be NULL terminated as you can expect from @@ -48,6 +42,12 @@ public: protected: llvm::SmallVector<char, N> m_packet; + + virtual size_t WriteImpl(const void *s, size_t length) { + if (s && length) + m_packet.append((const char *)s, ((const char *)s) + length); + return length; + } }; } // namespace lldb_private diff --git a/include/lldb/Core/StreamFile.h b/include/lldb/Core/StreamFile.h index a26ae84c7be5..86db3e4ae487 100644 --- a/include/lldb/Core/StreamFile.h +++ b/include/lldb/Core/StreamFile.h @@ -12,11 +12,11 @@ #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 "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" -#include <stdint.h> // for uint32_t -#include <stdio.h> // for size_t, FILE +#include <stdint.h> +#include <stdio.h> namespace lldb_private { @@ -46,13 +46,13 @@ public: void Flush() override; - size_t Write(const void *s, size_t length) override; protected: //------------------------------------------------------------------ // Classes that inherit from StreamFile can see and modify these //------------------------------------------------------------------ File m_file; + size_t WriteImpl(const void *s, size_t length) override; private: DISALLOW_COPY_AND_ASSIGN(StreamFile); diff --git a/include/lldb/Core/StructuredDataImpl.h b/include/lldb/Core/StructuredDataImpl.h index 819d1d9e5d2f..2912f4ec7de0 100644 --- a/include/lldb/Core/StructuredDataImpl.h +++ b/include/lldb/Core/StructuredDataImpl.h @@ -10,8 +10,8 @@ #ifndef liblldb_StructuredDataImpl_h_ #define liblldb_StructuredDataImpl_h_ -#include "lldb/Core/Event.h" #include "lldb/Target/StructuredDataPlugin.h" +#include "lldb/Utility/Event.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StructuredData.h" diff --git a/include/lldb/Core/ThreadSafeDenseMap.h b/include/lldb/Core/ThreadSafeDenseMap.h index 9b52e0355314..2fc428c4f7d4 100644 --- a/include/lldb/Core/ThreadSafeDenseMap.h +++ b/include/lldb/Core/ThreadSafeDenseMap.h @@ -11,14 +11,10 @@ #ifndef liblldb_ThreadSafeDenseMap_h_ #define liblldb_ThreadSafeDenseMap_h_ -// C Includes -// C++ Includes #include <mutex> -// Other libraries and framework includes #include "llvm/ADT/DenseMap.h" -// Project includes namespace lldb_private { diff --git a/include/lldb/Core/ThreadSafeDenseSet.h b/include/lldb/Core/ThreadSafeDenseSet.h index 44ec2464385f..74a010544705 100644 --- a/include/lldb/Core/ThreadSafeDenseSet.h +++ b/include/lldb/Core/ThreadSafeDenseSet.h @@ -11,14 +11,10 @@ #ifndef liblldb_ThreadSafeDenseSet_h_ #define liblldb_ThreadSafeDenseSet_h_ -// C Includes -// C++ Includes #include <mutex> -// Other libraries and framework includes #include "llvm/ADT/DenseSet.h" -// Project includes namespace lldb_private { diff --git a/include/lldb/Core/ThreadSafeSTLMap.h b/include/lldb/Core/ThreadSafeSTLMap.h index 5520920c4559..4058fdfe15a8 100644 --- a/include/lldb/Core/ThreadSafeSTLMap.h +++ b/include/lldb/Core/ThreadSafeSTLMap.h @@ -10,13 +10,9 @@ #ifndef liblldb_ThreadSafeSTLMap_h_ #define liblldb_ThreadSafeSTLMap_h_ -// C Includes -// C++ Includes #include <map> #include <mutex> -// Other libraries and framework includes -// Project includes #include "lldb/lldb-defines.h" namespace lldb_private { diff --git a/include/lldb/Core/ThreadSafeSTLVector.h b/include/lldb/Core/ThreadSafeSTLVector.h index 466f4309c2d5..b65936f81fec 100644 --- a/include/lldb/Core/ThreadSafeSTLVector.h +++ b/include/lldb/Core/ThreadSafeSTLVector.h @@ -11,13 +11,9 @@ #ifndef liblldb_ThreadSafeSTLVector_h_ #define liblldb_ThreadSafeSTLVector_h_ -// C Includes -// C++ Includes #include <mutex> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/lldb-defines.h" namespace lldb_private { diff --git a/include/lldb/Core/ThreadSafeValue.h b/include/lldb/Core/ThreadSafeValue.h index 10ef8fa41d0c..35424a1791e6 100644 --- a/include/lldb/Core/ThreadSafeValue.h +++ b/include/lldb/Core/ThreadSafeValue.h @@ -10,13 +10,9 @@ #ifndef liblldb_ThreadSafeValue_h_ #define liblldb_ThreadSafeValue_h_ -// C Includes -// C++ Includes #include <mutex> -// Other libraries and framework includes -// Project includes #include "lldb/lldb-defines.h" namespace lldb_private { diff --git a/include/lldb/Core/UniqueCStringMap.h b/include/lldb/Core/UniqueCStringMap.h index fe3e831a6045..cfb84b4c2160 100644 --- a/include/lldb/Core/UniqueCStringMap.h +++ b/include/lldb/Core/UniqueCStringMap.h @@ -10,13 +10,9 @@ #ifndef liblldb_UniqueCStringMap_h_ #define liblldb_UniqueCStringMap_h_ -// C Includes -// C++ Includes #include <algorithm> #include <vector> -// Other libraries and framework includes -// Project includes #include "lldb/Utility/ConstString.h" #include "lldb/Utility/RegularExpression.h" @@ -221,7 +217,7 @@ public: // } // my_map.Sort(); //------------------------------------------------------------------ - void Sort() { std::sort(m_map.begin(), m_map.end()); } + void Sort() { llvm::sort(m_map.begin(), m_map.end()); } //------------------------------------------------------------------ // Since we are using a vector to contain our items it will always double its diff --git a/include/lldb/Core/UserSettingsController.h b/include/lldb/Core/UserSettingsController.h index aefd42e751ab..350b5babb47b 100644 --- a/include/lldb/Core/UserSettingsController.h +++ b/include/lldb/Core/UserSettingsController.h @@ -10,16 +10,16 @@ #ifndef liblldb_UserSettingsController_h_ #define liblldb_UserSettingsController_h_ -#include "lldb/Utility/Status.h" // for Status -#include "lldb/lldb-forward.h" // for OptionValuePropertiesSP -#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType +#include "lldb/Utility/Status.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" -#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/ADT/StringRef.h" #include <vector> -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class CommandInterpreter; diff --git a/include/lldb/Core/Value.h b/include/lldb/Core/Value.h index 801e818c6f5c..249adb24fbc9 100644 --- a/include/lldb/Core/Value.h +++ b/include/lldb/Core/Value.h @@ -10,20 +10,20 @@ #ifndef liblldb_Value_h_ #define liblldb_Value_h_ -#include "lldb/Core/Scalar.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/Scalar.h" #include "lldb/Utility/Status.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 "lldb/lldb-enumerations.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-private-types.h" -#include "llvm/ADT/APInt.h" // for APInt +#include "llvm/ADT/APInt.h" #include <vector> -#include <stdint.h> // for uint8_t, uint32_t, uint64_t -#include <string.h> // for size_t, memcpy +#include <stdint.h> +#include <string.h> namespace lldb_private { class DataExtractor; diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h index fddc06413196..cb6de7b41807 100644 --- a/include/lldb/Core/ValueObject.h +++ b/include/lldb/Core/ValueObject.h @@ -12,7 +12,7 @@ #include "lldb/Core/Value.h" #include "lldb/Symbol/CompilerType.h" -#include "lldb/Symbol/Type.h" // for TypeImpl +#include "lldb/Symbol/Type.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Utility/ConstString.h" @@ -20,26 +20,26 @@ #include "lldb/Utility/SharedCluster.h" #include "lldb/Utility/Status.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 "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-types.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/ADT/StringRef.h" #include <functional> #include <initializer_list> #include <map> -#include <mutex> // for recursive_mutex -#include <string> // for string -#include <utility> // for pair +#include <mutex> +#include <string> +#include <utility> -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class Declaration; } @@ -635,9 +635,6 @@ public: virtual void SetLiveAddress(lldb::addr_t addr = LLDB_INVALID_ADDRESS, AddressType address_type = eAddressTypeLoad) {} - // Find the address of the C++ vtable pointer - virtual lldb::addr_t GetCPPVTableAddress(AddressType &address_type); - virtual lldb::ValueObjectSP Cast(const CompilerType &compiler_type); virtual lldb::ValueObjectSP CastPointerType(const char *name, diff --git a/include/lldb/Core/ValueObjectCast.h b/include/lldb/Core/ValueObjectCast.h index aaa1ecb67db8..34814d9b17bb 100644 --- a/include/lldb/Core/ValueObjectCast.h +++ b/include/lldb/Core/ValueObjectCast.h @@ -11,13 +11,13 @@ #define liblldb_ValueObjectCast_h_ #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 "lldb/Symbol/CompilerType.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class ConstString; diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h index ec8c9e805cdf..6800775dc8f9 100644 --- a/include/lldb/Core/ValueObjectChild.h +++ b/include/lldb/Core/ValueObjectChild.h @@ -12,17 +12,17 @@ #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 "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-types.h" #include "llvm/ADT/Optional.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t, int32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h index 1f56129df24a..c1c56d8dcb22 100644 --- a/include/lldb/Core/ValueObjectConstResult.h +++ b/include/lldb/Core/ValueObjectConstResult.h @@ -10,20 +10,20 @@ #ifndef liblldb_ValueObjectConstResult_h_ #define liblldb_ValueObjectConstResult_h_ -#include "lldb/Core/Value.h" // for Value +#include "lldb/Core/Value.h" #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/Status.h" // for Status -#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 "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Status.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class DataExtractor; diff --git a/include/lldb/Core/ValueObjectConstResultCast.h b/include/lldb/Core/ValueObjectConstResultCast.h index 442cce420855..bb2b4e6f092f 100644 --- a/include/lldb/Core/ValueObjectConstResultCast.h +++ b/include/lldb/Core/ValueObjectConstResultCast.h @@ -12,14 +12,14 @@ #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 "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, int32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class DataExtractor; diff --git a/include/lldb/Core/ValueObjectConstResultChild.h b/include/lldb/Core/ValueObjectConstResultChild.h index a74da0013aba..f14fb75640e6 100644 --- a/include/lldb/Core/ValueObjectConstResultChild.h +++ b/include/lldb/Core/ValueObjectConstResultChild.h @@ -12,14 +12,14 @@ #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 "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, int32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class DataExtractor; } @@ -63,6 +63,9 @@ public: lldb::ValueObjectSP AddressOf(Status &error) override; + lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, + AddressType *address_type = nullptr) override; + size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1) override; diff --git a/include/lldb/Core/ValueObjectConstResultImpl.h b/include/lldb/Core/ValueObjectConstResultImpl.h index d86f25e30579..5ea47bb3b3fa 100644 --- a/include/lldb/Core/ValueObjectConstResultImpl.h +++ b/include/lldb/Core/ValueObjectConstResultImpl.h @@ -10,14 +10,14 @@ #ifndef liblldb_ValueObjectConstResultImpl_h_ #define liblldb_ValueObjectConstResultImpl_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 "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, int32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class CompilerType; } diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h index 018ee2c764bf..0c9ec8cce06e 100644 --- a/include/lldb/Core/ValueObjectDynamicValue.h +++ b/include/lldb/Core/ValueObjectDynamicValue.h @@ -10,20 +10,20 @@ #ifndef liblldb_ValueObjectDynamicValue_h_ #define liblldb_ValueObjectDynamicValue_h_ -#include "lldb/Core/Address.h" // for Address +#include "lldb/Core/Address.h" #include "lldb/Core/ValueObject.h" -#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Symbol/CompilerType.h" #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 "lldb/Utility/ConstString.h" +#include "lldb/Utility/SharingPtr.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" -#include <assert.h> // for assert -#include <stddef.h> // for size_t -#include <stdint.h> // for uint64_t, uint32_t +#include <assert.h> +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class DataExtractor; diff --git a/include/lldb/Core/ValueObjectList.h b/include/lldb/Core/ValueObjectList.h index a0d2e681dedb..d17510f7f581 100644 --- a/include/lldb/Core/ValueObjectList.h +++ b/include/lldb/Core/ValueObjectList.h @@ -10,12 +10,12 @@ #ifndef liblldb_ValueObjectList_h_ #define liblldb_ValueObjectList_h_ -#include "lldb/lldb-forward.h" // for ValueObjectSP -#include "lldb/lldb-types.h" // for user_id_t +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" #include <vector> -#include <stddef.h> // for size_t +#include <stddef.h> namespace lldb_private { class ValueObject; diff --git a/include/lldb/Core/ValueObjectMemory.h b/include/lldb/Core/ValueObjectMemory.h index 8bb649cc3c52..c4b946af98ce 100644 --- a/include/lldb/Core/ValueObjectMemory.h +++ b/include/lldb/Core/ValueObjectMemory.h @@ -10,17 +10,17 @@ #ifndef liblldb_ValueObjectMemory_h_ #define liblldb_ValueObjectMemory_h_ -#include "lldb/Core/Address.h" // for Address +#include "lldb/Core/Address.h" #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 "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringRef.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class ExecutionContextScope; diff --git a/include/lldb/Core/ValueObjectRegister.h b/include/lldb/Core/ValueObjectRegister.h index 2aaef9bee99e..fb10c259e7d0 100644 --- a/include/lldb/Core/ValueObjectRegister.h +++ b/include/lldb/Core/ValueObjectRegister.h @@ -10,17 +10,17 @@ #ifndef liblldb_ValueObjectRegister_h_ #define liblldb_ValueObjectRegister_h_ -#include "lldb/Core/RegisterValue.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 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 "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/RegisterValue.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-types.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t, int32_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class DataExtractor; diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h index b3af6c0ae827..9495d4ca5e25 100644 --- a/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -13,17 +13,17 @@ #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 "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-private-enumerations.h" -#include <cstdint> // for uint32_t, uint64_t +#include <cstdint> #include <memory> -#include <stddef.h> // for size_t +#include <stddef.h> namespace lldb_private { class Declaration; diff --git a/include/lldb/Core/ValueObjectVariable.h b/include/lldb/Core/ValueObjectVariable.h index 9dd140a84f45..81a8eabdacbb 100644 --- a/include/lldb/Core/ValueObjectVariable.h +++ b/include/lldb/Core/ValueObjectVariable.h @@ -12,15 +12,15 @@ #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 "lldb/Core/Value.h" +#include "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t, uint64_t +#include <stddef.h> +#include <stdint.h> namespace lldb_private { class DataExtractor; |
