diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:12:36 +0000 |
commit | ef5d0b5e97ec8e6fa395d377b09aa7755e345b4f (patch) | |
tree | 27916256fdeeb57d10d2f3d6948be5d71a703215 /include/lldb | |
parent | 76e0736e7fcfeb179779e49c05604464b1ccd704 (diff) |
Notes
Diffstat (limited to 'include/lldb')
77 files changed, 997 insertions, 298 deletions
diff --git a/include/lldb/API/LLDB.h b/include/lldb/API/LLDB.h index cf61b10184d6c..c51ced893d7a7 100644 --- a/include/lldb/API/LLDB.h +++ b/include/lldb/API/LLDB.h @@ -18,6 +18,7 @@ #include "lldb/API/SBAttachInfo.h" #include "lldb/API/SBBlock.h" #include "lldb/API/SBBreakpoint.h" +#include "lldb/API/SBBreakpointName.h" #include "lldb/API/SBBreakpointLocation.h" #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBCommandInterpreter.h" @@ -49,6 +50,7 @@ #include "lldb/API/SBModuleSpec.h" #include "lldb/API/SBPlatform.h" #include "lldb/API/SBProcess.h" +#include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBSection.h" diff --git a/include/lldb/API/SBBreakpoint.h b/include/lldb/API/SBBreakpoint.h index 9abc9cd39dcb5..216d675b9d22e 100644 --- a/include/lldb/API/SBBreakpoint.h +++ b/include/lldb/API/SBBreakpoint.h @@ -18,9 +18,6 @@ namespace lldb { class LLDB_API SBBreakpoint { public: - typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process, - SBThread &thread, - lldb::SBBreakpointLocation &location); SBBreakpoint(); @@ -70,6 +67,10 @@ public: const char *GetCondition(); + void SetAutoContinue(bool auto_continue); + + bool GetAutoContinue(); + void SetThreadID(lldb::tid_t sb_thread_id); lldb::tid_t GetThreadID(); @@ -86,7 +87,7 @@ public: const char *GetQueueName() const; - void SetCallback(BreakpointHitCallback callback, void *baton); + void SetCallback(SBBreakpointHitCallback callback, void *baton); void SetScriptCallbackFunction(const char *callback_function_name); @@ -129,14 +130,11 @@ public: private: friend class SBBreakpointList; friend class SBBreakpointLocation; + friend class SBBreakpointName; friend class SBTarget; SBBreakpoint(const lldb::BreakpointSP &bp_sp); - static bool PrivateBreakpointHitCallback( - void *baton, lldb_private::StoppointCallbackContext *context, - lldb::user_id_t break_id, lldb::user_id_t break_loc_id); - lldb::BreakpointSP GetSP() const; lldb::BreakpointWP m_opaque_wp; diff --git a/include/lldb/API/SBBreakpointLocation.h b/include/lldb/API/SBBreakpointLocation.h index 0b5ba79d784fa..4b34bcbf1f28b 100644 --- a/include/lldb/API/SBBreakpointLocation.h +++ b/include/lldb/API/SBBreakpointLocation.h @@ -38,6 +38,8 @@ public: bool IsEnabled(); + uint32_t GetHitCount(); + uint32_t GetIgnoreCount(); void SetIgnoreCount(uint32_t n); @@ -45,11 +47,19 @@ public: void SetCondition(const char *condition); const char *GetCondition(); + + void SetAutoContinue(bool auto_continue); + + bool GetAutoContinue(); void SetScriptCallbackFunction(const char *callback_function_name); SBError SetScriptCallbackBody(const char *script_body_text); + + void SetCommandLineCommands(SBStringList &commands); + bool GetCommandLineCommands(SBStringList &commands); + void SetThreadID(lldb::tid_t sb_thread_id); lldb::tid_t GetThreadID(); @@ -76,6 +86,7 @@ public: private: friend class SBBreakpoint; + friend class SBBreakpointCallbackBaton; void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp); BreakpointLocationSP GetSP() const; diff --git a/include/lldb/API/SBBreakpointName.h b/include/lldb/API/SBBreakpointName.h new file mode 100644 index 0000000000000..321f0d784d6f7 --- /dev/null +++ b/include/lldb/API/SBBreakpointName.h @@ -0,0 +1,118 @@ +//===-- SBBreakpointName.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_SBBreakpointName_h_ +#define LLDB_SBBreakpointName_h_ + +#include "lldb/API/SBDefines.h" + +class SBBreakpointNameImpl; + +namespace lldb { + +class LLDB_API SBBreakpointName { +public: +// typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process, +// SBThread &thread, +// lldb::SBBreakpointLocation &location); + + SBBreakpointName(); + + SBBreakpointName(SBTarget &target, const char *name); + + SBBreakpointName(SBBreakpoint &bkpt, const char *name); + + SBBreakpointName(const lldb::SBBreakpointName &rhs); + + ~SBBreakpointName(); + + const lldb::SBBreakpointName &operator=(const lldb::SBBreakpointName &rhs); + + // Tests to see if the opaque breakpoint object in this object matches the + // opaque breakpoint object in "rhs". + bool operator==(const lldb::SBBreakpointName &rhs); + + bool operator!=(const lldb::SBBreakpointName &rhs); + + bool IsValid() const; + + const char *GetName() const; + + void SetEnabled(bool enable); + + bool IsEnabled(); + + void SetOneShot(bool one_shot); + + bool IsOneShot() const; + + void SetIgnoreCount(uint32_t count); + + uint32_t GetIgnoreCount() const; + + void SetCondition(const char *condition); + + const char *GetCondition(); + + void SetAutoContinue(bool auto_continue); + + bool GetAutoContinue(); + + void SetThreadID(lldb::tid_t sb_thread_id); + + lldb::tid_t GetThreadID(); + + void SetThreadIndex(uint32_t index); + + uint32_t GetThreadIndex() const; + + void SetThreadName(const char *thread_name); + + const char *GetThreadName() const; + + void SetQueueName(const char *queue_name); + + const char *GetQueueName() const; + + void SetCallback(SBBreakpointHitCallback callback, void *baton); + + void SetScriptCallbackFunction(const char *callback_function_name); + + void SetCommandLineCommands(SBStringList &commands); + + bool GetCommandLineCommands(SBStringList &commands); + + SBError SetScriptCallbackBody(const char *script_body_text); + + const char *GetHelpString() const; + void SetHelpString(const char *help_string); + + bool GetAllowList() const; + void SetAllowList(bool value); + + bool GetAllowDelete(); + void SetAllowDelete(bool value); + + bool GetAllowDisable(); + void SetAllowDisable(bool value); + + bool GetDescription(lldb::SBStream &description); + +private: + friend class SBTarget; + + lldb_private::BreakpointName *GetBreakpointName() const; + void UpdateName(lldb_private::BreakpointName &bp_name); + + std::unique_ptr<SBBreakpointNameImpl> m_impl_up; +}; + +} // namespace lldb + +#endif // LLDB_SBBreakpointName_h_ diff --git a/include/lldb/API/SBCommandInterpreter.h b/include/lldb/API/SBCommandInterpreter.h index f684071740e39..80f24ceca7b41 100644 --- a/include/lldb/API/SBCommandInterpreter.h +++ b/include/lldb/API/SBCommandInterpreter.h @@ -165,6 +165,8 @@ public: int match_start_point, int max_return_elements, lldb::SBStringList &matches); + bool WasInterrupted() const; + // Catch commands before they execute by registering a callback that will // get called when the command gets executed. This allows GUI or command // line interfaces to intercept a command and stop it from happening diff --git a/include/lldb/API/SBDebugger.h b/include/lldb/API/SBDebugger.h index 9084943b91313..8379a6911afc9 100644 --- a/include/lldb/API/SBDebugger.h +++ b/include/lldb/API/SBDebugger.h @@ -109,6 +109,8 @@ public: const char *archname); lldb::SBTarget CreateTarget(const char *filename); + + lldb::SBTarget GetDummyTarget(); // Return true if target is deleted from the target list of the debugger. bool DeleteTarget(lldb::SBTarget &target); @@ -132,6 +134,25 @@ public: void SetSelectedPlatform(lldb::SBPlatform &platform); + /// Get the number of currently active platforms. + uint32_t GetNumPlatforms(); + + /// Get one of the currently active platforms. + lldb::SBPlatform GetPlatformAtIndex(uint32_t idx); + + /// Get the number of available platforms. + /// + /// The return value should match the number of entries output by the + /// "platform list" command. + uint32_t GetNumAvailablePlatforms(); + + /// Get the name and description of one of the available platforms. + /// + /// @param[in] idx + /// Zero-based index of the platform for which info should be retrieved, + /// must be less than the value returned by GetNumAvailablePlatforms(). + lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx); + lldb::SBSourceManager GetSourceManager(); // REMOVE: just for a quick fix, need to expose platforms through diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h index d70e912d9200f..ec92c91967379 100644 --- a/include/lldb/API/SBDefines.h +++ b/include/lldb/API/SBDefines.h @@ -32,6 +32,8 @@ class LLDB_API SBAddress; class LLDB_API SBBlock; class LLDB_API SBBreakpoint; class LLDB_API SBBreakpointLocation; +class LLDB_API SBBreakpointName; +class LLDB_API SBBreakpointNameImpl; class LLDB_API SBBroadcaster; class LLDB_API SBCommand; class LLDB_API SBCommandInterpreter; @@ -65,6 +67,7 @@ class LLDB_API SBModule; class LLDB_API SBModuleSpec; class LLDB_API SBModuleSpecList; class LLDB_API SBProcess; +class LLDB_API SBProcessInfo; class LLDB_API SBQueue; class LLDB_API SBQueueItem; class LLDB_API SBSection; @@ -98,6 +101,10 @@ class LLDB_API SBValueList; class LLDB_API SBVariablesOptions; class LLDB_API SBWatchpoint; class LLDB_API SBUnixSignals; + +typedef bool (*SBBreakpointHitCallback)(void *baton, SBProcess &process, + SBThread &thread, + lldb::SBBreakpointLocation &location); } #endif // LLDB_SBDefines_h_ diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h index a099a9be271a0..a27d2d0426907 100644 --- a/include/lldb/API/SBError.h +++ b/include/lldb/API/SBError.h @@ -67,6 +67,7 @@ protected: friend class SBWatchpoint; friend class SBBreakpoint; friend class SBBreakpointLocation; + friend class SBBreakpointName; lldb_private::Status *get(); diff --git a/include/lldb/API/SBFileSpec.h b/include/lldb/API/SBFileSpec.h index a31d95abb493b..33e48f5c7c41b 100644 --- a/include/lldb/API/SBFileSpec.h +++ b/include/lldb/API/SBFileSpec.h @@ -65,6 +65,7 @@ private: friend class SBModuleSpec; friend class SBPlatform; friend class SBProcess; + friend class SBProcessInfo; friend class SBSourceManager; friend class SBThread; friend class SBTarget; diff --git a/include/lldb/API/SBProcess.h b/include/lldb/API/SBProcess.h index d57d5ce04f59f..2e8925941fb74 100644 --- a/include/lldb/API/SBProcess.h +++ b/include/lldb/API/SBProcess.h @@ -12,6 +12,7 @@ #include "lldb/API/SBDefines.h" #include "lldb/API/SBError.h" +#include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBTarget.h" #include <stdio.h> @@ -380,6 +381,15 @@ public: //------------------------------------------------------------------ lldb::SBMemoryRegionInfoList GetMemoryRegions(); + //------------------------------------------------------------------ + /// Return information about the process. + /// + /// Valid process info will only be returned when the process is + /// alive, use SBProcessInfo::IsValid() to check returned info is + /// valid. + //------------------------------------------------------------------ + lldb::SBProcessInfo GetProcessInfo(); + protected: friend class SBAddress; friend class SBBreakpoint; diff --git a/include/lldb/API/SBProcessInfo.h b/include/lldb/API/SBProcessInfo.h new file mode 100644 index 0000000000000..421227f82c2d9 --- /dev/null +++ b/include/lldb/API/SBProcessInfo.h @@ -0,0 +1,64 @@ +//===-- SBProcessInfo.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_SBProcessInfo_h_ +#define LLDB_SBProcessInfo_h_ + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +class LLDB_API SBProcessInfo { +public: + SBProcessInfo(); + SBProcessInfo(const SBProcessInfo &rhs); + + ~SBProcessInfo(); + + SBProcessInfo &operator=(const SBProcessInfo &rhs); + + bool IsValid() const; + + const char *GetName(); + + SBFileSpec GetExecutableFile(); + + lldb::pid_t GetProcessID(); + + uint32_t GetUserID(); + + uint32_t GetGroupID(); + + bool UserIDIsValid(); + + bool GroupIDIsValid(); + + uint32_t GetEffectiveUserID(); + + uint32_t GetEffectiveGroupID(); + + bool EffectiveUserIDIsValid(); + + bool EffectiveGroupIDIsValid(); + + lldb::pid_t GetParentProcessID(); + +private: + friend class SBProcess; + + lldb_private::ProcessInstanceInfo &ref(); + + void SetProcessInfo(const lldb_private::ProcessInstanceInfo &proc_info_ref); + + std::unique_ptr<lldb_private::ProcessInstanceInfo> m_opaque_ap; +}; + +} // namespace lldb + +#endif // LLDB_SBProcessInfo_h_ diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h index 68fcae21c08e7..a75afc7ee375a 100644 --- a/include/lldb/API/SBStream.h +++ b/include/lldb/API/SBStream.h @@ -53,6 +53,7 @@ protected: friend class SBBlock; friend class SBBreakpoint; friend class SBBreakpointLocation; + friend class SBBreakpointName; friend class SBCommandReturnObject; friend class SBCompileUnit; friend class SBData; diff --git a/include/lldb/API/SBStringList.h b/include/lldb/API/SBStringList.h index 66b5172a0b3e6..943384e544cd1 100644 --- a/include/lldb/API/SBStringList.h +++ b/include/lldb/API/SBStringList.h @@ -44,6 +44,8 @@ protected: friend class SBCommandInterpreter; friend class SBDebugger; friend class SBBreakpoint; + friend class SBBreakpointLocation; + friend class SBBreakpointName; SBStringList(const lldb_private::StringList *lldb_strings); diff --git a/include/lldb/API/SBStructuredData.h b/include/lldb/API/SBStructuredData.h index f7a6469bb8de3..f3baaf7c48013 100644 --- a/include/lldb/API/SBStructuredData.h +++ b/include/lldb/API/SBStructuredData.h @@ -98,6 +98,7 @@ public: protected: friend class SBTraceOptions; + friend class SBDebugger; StructuredDataImplUP m_impl_up; }; diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h index 62398fcd4b94f..4085a16b43fbc 100644 --- a/include/lldb/API/SBTarget.h +++ b/include/lldb/API/SBTarget.h @@ -218,14 +218,6 @@ public: lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid, lldb::SBError &error); -#if defined(__APPLE__) - // We need to keep this around for a build or two since Xcode links - // to the 32 bit version of this function. We will take it out soon. - lldb::SBProcess AttachToProcessWithID(SBListener &listener, - ::pid_t pid, // 32 bit int process ID - lldb::SBError &error); // DEPRECATED -#endif - //------------------------------------------------------------------ /// Attach to process with name. /// @@ -724,6 +716,10 @@ public: // Finds all breakpoints by name, returning the list in bkpt_list. Returns // false if the name is not a valid breakpoint name, true otherwise. bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list); + + void GetBreakpointNames(SBStringList &names); + + void DeleteBreakpointName(const char *name); bool EnableAllBreakpoints(); @@ -818,6 +814,7 @@ protected: friend class SBAddress; friend class SBBlock; friend class SBBreakpointList; + friend class SBBreakpointNameImpl; friend class SBDebugger; friend class SBExecutionContext; friend class SBFunction; diff --git a/include/lldb/API/SBThread.h b/include/lldb/API/SBThread.h index 502e5c973ef55..7f1cf10cc456b 100644 --- a/include/lldb/API/SBThread.h +++ b/include/lldb/API/SBThread.h @@ -196,6 +196,7 @@ public: protected: friend class SBBreakpoint; friend class SBBreakpointLocation; + friend class SBBreakpointCallbackBaton; friend class SBExecutionContext; friend class SBFrame; friend class SBProcess; diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h index 41241334dcf9f..9a798090a59fb 100644 --- a/include/lldb/Breakpoint/Breakpoint.h +++ b/include/lldb/Breakpoint/Breakpoint.h @@ -22,6 +22,7 @@ #include "lldb/Breakpoint/BreakpointID.h" #include "lldb/Breakpoint/BreakpointLocationCollection.h" #include "lldb/Breakpoint/BreakpointLocationList.h" +#include "lldb/Breakpoint/BreakpointName.h" #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/Stoppoint.h" #include "lldb/Core/Event.h" @@ -421,6 +422,18 @@ public: bool IsOneShot() const; //------------------------------------------------------------------ + /// If \a auto_continue is \b true, breakpoint will auto-continue when on hit. + //------------------------------------------------------------------ + void SetAutoContinue(bool auto_continue); + + //------------------------------------------------------------------ + /// Check the AutoContinue state. + /// @return + /// \b true if the breakpoint is set to auto-continue, \b false otherwise. + //------------------------------------------------------------------ + bool IsAutoContinue() const; + + //------------------------------------------------------------------ /// Set the valid thread to be checked when the breakpoint is hit. /// @param[in] thread_id /// If this thread hits the breakpoint, we stop, otherwise not. @@ -591,6 +604,16 @@ public: BreakpointOptions *GetOptions(); //------------------------------------------------------------------ + /// Returns the BreakpointOptions structure set at the breakpoint level. + /// + /// Meant to be used by the BreakpointLocation class. + /// + /// @return + /// A pointer to this breakpoint's BreakpointOptions. + //------------------------------------------------------------------ + const BreakpointOptions *GetOptions() const; + + //------------------------------------------------------------------ /// Invoke the callback action when the breakpoint is hit. /// /// Meant to be used by the BreakpointLocation class. @@ -613,13 +636,16 @@ public: lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; } - bool AddName(llvm::StringRef new_name, Status &error); +private: // The target needs to manage adding & removing names. It will do the + // checking for name validity as well. + bool AddName(llvm::StringRef new_name); void RemoveName(const char *name_to_remove) { if (name_to_remove) m_name_list.erase(name_to_remove); } - + +public: bool MatchesName(const char *name) { return m_name_list.find(name) != m_name_list.end(); } @@ -651,6 +677,25 @@ public: bool EvaluatePrecondition(StoppointCallbackContext &context); BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; } + + // Produces the OR'ed values for all the names assigned to this breakpoint. + const BreakpointName::Permissions &GetPermissions() const { + return m_permissions; + } + + BreakpointName::Permissions &GetPermissions() { + return m_permissions; + } + + bool AllowList() const { + return GetPermissions().GetAllowList(); + } + bool AllowDisable() const { + return GetPermissions().GetAllowDisable(); + } + bool AllowDelete() const { + return GetPermissions().GetAllowDelete(); + } protected: friend class Target; @@ -750,6 +795,7 @@ private: // hit. This is kept // separately from the locations hit counts, since locations can go away when // their backing library gets unloaded, and we would lose hit counts. + BreakpointName::Permissions m_permissions; void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind); diff --git a/include/lldb/Breakpoint/BreakpointIDList.h b/include/lldb/Breakpoint/BreakpointIDList.h index 34cfbfe3268df..5877b6c551ad2 100644 --- a/include/lldb/Breakpoint/BreakpointIDList.h +++ b/include/lldb/Breakpoint/BreakpointIDList.h @@ -18,7 +18,9 @@ // Other libraries and framework includes // Project includes +#include "lldb/lldb-enumerations.h" #include "lldb/Breakpoint/BreakpointID.h" +#include "lldb/Breakpoint/BreakpointName.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -64,6 +66,8 @@ public: static void FindAndReplaceIDRanges(Args &old_args, Target *target, bool allow_locations, + BreakpointName::Permissions + ::PermissionKinds purpose, CommandReturnObject &result, Args &new_args); diff --git a/include/lldb/Breakpoint/BreakpointList.h b/include/lldb/Breakpoint/BreakpointList.h index 2865288acc595..9f38f8aa120d5 100644 --- a/include/lldb/Breakpoint/BreakpointList.h +++ b/include/lldb/Breakpoint/BreakpointList.h @@ -154,12 +154,21 @@ public: void SetEnabledAll(bool enabled); + void SetEnabledAllowed(bool enabled); + //------------------------------------------------------------------ /// Removes all the breakpoints from this list. //------------------------------------------------------------------ void RemoveAll(bool notify); //------------------------------------------------------------------ + /// Removes all the breakpoints from this list - first checking the + /// ePermDelete on the breakpoints. This call should be used unless you + /// are shutting down and need to actually clear them all. + //------------------------------------------------------------------ + void RemoveAllowed(bool notify); + + //------------------------------------------------------------------ /// Tell all the breakpoints to update themselves due to a change in the /// modules in \a module_list. \a added says whether the module was loaded /// or unloaded. diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h index a1086aa3fe5f8..b68a9ffad04c4 100644 --- a/include/lldb/Breakpoint/BreakpointLocation.h +++ b/include/lldb/Breakpoint/BreakpointLocation.h @@ -17,6 +17,7 @@ // Other libraries and framework includes // Project includes +#include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Breakpoint/StoppointLocation.h" #include "lldb/Core/Address.h" #include "lldb/Utility/UserID.h" @@ -106,6 +107,19 @@ public: bool IsEnabled() const; //------------------------------------------------------------------ + /// If \a auto_continue is \b true, set the breakpoint to continue when hit. + //------------------------------------------------------------------ + void SetAutoContinue(bool auto_continue); + + //------------------------------------------------------------------ + /// Check the AutoContinue state. + /// + /// @return + /// \b true if the breakpoint is set to auto-continue, \b false if not. + //------------------------------------------------------------------ + bool IsAutoContinue() const; + + //------------------------------------------------------------------ /// Return the current Ignore Count. /// /// @return @@ -255,14 +269,17 @@ public: //------------------------------------------------------------------ /// Use this to access breakpoint options from this breakpoint location. - /// This will point to the owning breakpoint's options unless options have - /// been set specifically on this location. + /// This will return the options that have a setting for the specified + /// BreakpointOptions kind. /// + /// @param[in] kind + /// The particular option you are looking up. /// @return /// A pointer to the containing breakpoint's options if this /// location doesn't have its own copy. //------------------------------------------------------------------ - const BreakpointOptions *GetOptionsNoCreate() const; + const BreakpointOptions *GetOptionsSpecifyingKind( + BreakpointOptions::OptionKind kind) const; bool ValidForThisThread(Thread *thread); diff --git a/include/lldb/Breakpoint/BreakpointName.h b/include/lldb/Breakpoint/BreakpointName.h new file mode 100644 index 0000000000000..1cfa141011a0b --- /dev/null +++ b/include/lldb/Breakpoint/BreakpointName.h @@ -0,0 +1,213 @@ +//===-- BreakpointName.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_Breakpoint_Name_h_ +#define liblldb_Breakpoint_Name_h_ + +// C Includes +// C++ Includes +#include <memory> +#include <string> +#include <unordered_set> +#include <vector> + +// Other libraries and framework includes +// Project includes +#include "lldb/Breakpoint/BreakpointID.h" +#include "lldb/Breakpoint/BreakpointLocationCollection.h" +#include "lldb/Breakpoint/BreakpointLocationList.h" +#include "lldb/Breakpoint/BreakpointOptions.h" +#include "lldb/Breakpoint/Stoppoint.h" +#include "lldb/Core/Event.h" +#include "lldb/Core/SearchFilter.h" +#include "lldb/Utility/Flags.h" +#include "lldb/Utility/StringList.h" +#include "lldb/Utility/StructuredData.h" + +namespace lldb_private { + +class BreakpointName { +public: + class Permissions + { + public: + + enum PermissionKinds { listPerm = 0, disablePerm = 1, + deletePerm = 2, allPerms = 3 }; + + Permissions(bool in_list, bool in_disable, bool in_delete) + { + m_permissions[listPerm] = in_list; + m_permissions[disablePerm] = in_disable; + m_permissions[deletePerm] = in_delete; + m_set_mask.Set(permissions_mask[allPerms]); + } + + Permissions(const Permissions &rhs) + { + m_permissions[listPerm] = rhs.m_permissions[listPerm]; + m_permissions[disablePerm] = rhs.m_permissions[disablePerm]; + m_permissions[deletePerm] = rhs.m_permissions[deletePerm]; + m_set_mask = rhs.m_set_mask; + } + + Permissions() + { + m_permissions[listPerm] = true; + m_permissions[disablePerm] = true; + m_permissions[deletePerm] = true; + m_set_mask.Clear(); + } + + const Permissions &operator= (const Permissions &rhs) + { + if (this != &rhs) { + m_permissions[listPerm] = rhs.m_permissions[listPerm]; + m_permissions[disablePerm] = rhs.m_permissions[disablePerm]; + m_permissions[deletePerm] = rhs.m_permissions[deletePerm]; + m_set_mask = rhs.m_set_mask; + } + return *this; + } + + void Clear() { + *this = Permissions(); + } + + // Merge the permissions from incoming into this set of permissions. + // Only merge set permissions, and most restrictive permission wins. + void MergeInto(const Permissions &incoming) + { + MergePermission(incoming, listPerm); + MergePermission(incoming, disablePerm); + MergePermission(incoming, deletePerm); + } + + bool GetAllowList() const { return GetPermission(listPerm); } + bool SetAllowList(bool value) { return SetPermission(listPerm, value); } + + bool GetAllowDelete() const { return GetPermission(deletePerm); } + bool SetAllowDelete(bool value) { return SetPermission(deletePerm, value); } + + bool GetAllowDisable() const { return GetPermission(disablePerm); } + bool SetAllowDisable(bool value) { return SetPermission(disablePerm, + value); } + + bool GetPermission(enum PermissionKinds permission) const + { + return m_permissions[permission]; + } + + bool GetDescription(Stream *s, lldb::DescriptionLevel level); + + bool IsSet(enum PermissionKinds permission) const + { + return m_set_mask.Test(permissions_mask[permission]); + } + + bool AnySet() { + return m_set_mask.AnySet(permissions_mask[allPerms]); + } + + private: + static const Flags::ValueType permissions_mask[allPerms + 1]; + + bool m_permissions[allPerms]; + Flags m_set_mask; + + bool SetPermission(enum PermissionKinds permission, bool value) + { + bool old_value = m_permissions[permission]; + m_permissions[permission] = value; + m_set_mask.Set(permissions_mask[permission]); + return old_value; + } + + // If either side disallows the permission, the resultant disallows it. + void MergePermission(const Permissions &incoming, + enum PermissionKinds permission) + { + if (incoming.IsSet(permission)) + { + SetPermission(permission, !(m_permissions[permission] | + incoming.m_permissions[permission])); + } + } + }; + + BreakpointName(const ConstString &name, const char *help = nullptr) : + m_name(name), m_options(false) + { + SetHelp(help); + } + + BreakpointName(const ConstString &name, + BreakpointOptions &options, + const Permissions &permissions = Permissions(), + const char *help = nullptr) : + m_name(name), m_options(options), + m_permissions(permissions) { + SetHelp(help); + }; + + BreakpointName(const BreakpointName &rhs) : + m_name(rhs.m_name), m_options(rhs.m_options), + m_permissions(rhs.m_permissions), m_help(rhs.m_help) + {} + + BreakpointName(const ConstString &name, const Breakpoint &bkpt, + const char *help); + + const ConstString &GetName() const { return m_name; } + BreakpointOptions &GetOptions() { return m_options; } + const BreakpointOptions &GetOptions() const { return m_options; } + + void SetOptions(const BreakpointOptions &options) { + m_options = options; + } + + Permissions &GetPermissions() { return m_permissions; } + const Permissions &GetPermissions() const { return m_permissions; } + void SetPermissions(const Permissions &permissions) { + m_permissions = permissions; + } + + bool GetPermission(Permissions::PermissionKinds permission) const + { + return m_permissions.GetPermission(permission); + } + + void SetHelp(const char *description) + { + if (description) + m_help.assign(description); + else + m_help.clear(); + } + + const char *GetHelp() + { + return m_help.c_str(); + } + + // Returns true if any options were set in the name + bool GetDescription(Stream *s, lldb::DescriptionLevel level); + + void ConfigureBreakpoint(lldb::BreakpointSP bp_sp); + +private: + ConstString m_name; + BreakpointOptions m_options; + Permissions m_permissions; + std::string m_help; +}; + +} // namespace lldb_private + +#endif // liblldb_Breakpoint_Name_h_ diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h index 420d5915fd442..0229d52df4710 100644 --- a/include/lldb/Breakpoint/BreakpointOptions.h +++ b/include/lldb/Breakpoint/BreakpointOptions.h @@ -18,6 +18,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Utility/Baton.h" +#include "lldb/Utility/Flags.h" #include "lldb/Utility/StringList.h" #include "lldb/Utility/StructuredData.h" #include "lldb/lldb-private.h" @@ -32,7 +33,23 @@ namespace lldb_private { //---------------------------------------------------------------------- class BreakpointOptions { +friend class BreakpointLocation; +friend class BreakpointName; +friend class lldb_private::BreakpointOptionGroup; +friend class Breakpoint; + public: + enum OptionKind { + eCallback = 1 << 0, + eEnabled = 1 << 1, + eOneShot = 1 << 2, + eIgnoreCount = 1 << 3, + eThreadSpec = 1 << 4, + eCondition = 1 << 5, + eAutoContinue = 1 << 6, + eAllOptions = (eCallback | eEnabled | eOneShot | eIgnoreCount | eThreadSpec + | eCondition | eAutoContinue) + }; struct CommandData { CommandData() : user_source(), script_source(), @@ -87,14 +104,6 @@ public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - //------------------------------------------------------------------ - /// Default constructor. The breakpoint is enabled, and has no condition, - /// callback, ignore count, etc... - //------------------------------------------------------------------ - BreakpointOptions(); - BreakpointOptions(const BreakpointOptions &rhs); - - static BreakpointOptions *CopyOptionsNoCallback(BreakpointOptions &rhs); //------------------------------------------------------------------ /// This constructor allows you to specify all the breakpoint options @@ -112,7 +121,15 @@ public: /// //------------------------------------------------------------------ BreakpointOptions(const char *condition, bool enabled = true, - int32_t ignore = 0, bool one_shot = false); + int32_t ignore = 0, bool one_shot = false, + bool auto_continue = false); + + //------------------------------------------------------------------ + /// Breakpoints make options with all flags set. Locations and Names make options + /// with no flags set. + //------------------------------------------------------------------ + BreakpointOptions(bool all_flags_set); + BreakpointOptions(const BreakpointOptions &rhs); virtual ~BreakpointOptions(); @@ -129,6 +146,11 @@ public: // Operators //------------------------------------------------------------------ const BreakpointOptions &operator=(const BreakpointOptions &rhs); + + //------------------------------------------------------------------ + /// Copy over only the options set in the incoming BreakpointOptions. + //------------------------------------------------------------------ + void CopyOverSetOptions(const BreakpointOptions &rhs); //------------------------------------------------------------------ // Callbacks @@ -290,7 +312,25 @@ public: //------------------------------------------------------------------ /// If \a enable is \b true, enable the breakpoint, if \b false disable it. //------------------------------------------------------------------ - void SetEnabled(bool enabled) { m_enabled = enabled; } + void SetEnabled(bool enabled) { + m_enabled = enabled; + m_set_flags.Set(eEnabled); + } + + //------------------------------------------------------------------ + /// Check the auto-continue state. + /// @return + /// \b true if the breakpoint is set to auto-continue, \b false otherwise. + //------------------------------------------------------------------ + bool IsAutoContinue() const { return m_auto_continue; } + + //------------------------------------------------------------------ + /// Set the auto-continue state. + //------------------------------------------------------------------ + void SetAutoContinue(bool auto_continue) { + m_auto_continue = auto_continue; + m_set_flags.Set(eAutoContinue); + } //------------------------------------------------------------------ /// Check the One-shot state. @@ -302,7 +342,10 @@ public: //------------------------------------------------------------------ /// If \a enable is \b true, enable the breakpoint, if \b false disable it. //------------------------------------------------------------------ - void SetOneShot(bool one_shot) { m_one_shot = one_shot; } + void SetOneShot(bool one_shot) { + m_one_shot = one_shot; + m_set_flags.Set(eOneShot); + } //------------------------------------------------------------------ /// Set the breakpoint to ignore the next \a count breakpoint hits. @@ -310,7 +353,10 @@ public: /// The number of breakpoint hits to ignore. //------------------------------------------------------------------ - void SetIgnoreCount(uint32_t n) { m_ignore_count = n; } + void SetIgnoreCount(uint32_t n) { + m_ignore_count = n; + m_set_flags.Set(eIgnoreCount); + } //------------------------------------------------------------------ /// Return the current Ignore Count. @@ -360,16 +406,28 @@ public: /// The breakpoint will take ownership of pointer held by this object. //------------------------------------------------------------------ void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data); - + + void Clear(); + + bool AnySet() const { + return m_set_flags.AnySet(eAllOptions); + } + protected: - //------------------------------------------------------------------ +//------------------------------------------------------------------ // Classes that inherit from BreakpointOptions can see and modify these //------------------------------------------------------------------ + bool IsOptionSet(OptionKind kind) + { + return m_set_flags.Test(kind); + } + enum class OptionNames { ConditionText = 0, IgnoreCount, EnabledState, OneShotState, + AutoContinue, LastOptionName }; static const char *g_option_names[(size_t)OptionNames::LastOptionName]; @@ -400,6 +458,9 @@ private: std::string m_condition_text; // The condition to test. size_t m_condition_text_hash; // Its hash, so that locations know when the // condition is updated. + bool m_auto_continue; // If set, auto-continue from breakpoint. + Flags m_set_flags; // Which options are set at this level. Drawn + // from BreakpointOptions::SetOptionsFlags. }; } // namespace lldb_private diff --git a/include/lldb/Core/Architecture.h b/include/lldb/Core/Architecture.h new file mode 100644 index 0000000000000..af774ecdaf9c6 --- /dev/null +++ b/include/lldb/Core/Architecture.h @@ -0,0 +1,43 @@ +//===-- Architecture.h ------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_CORE_ARCHITECTURE_H +#define LLDB_CORE_ARCHITECTURE_H + +#include "lldb/Core/PluginInterface.h" + +namespace lldb_private { + +class Architecture : public PluginInterface { +public: + Architecture() = default; + virtual ~Architecture() = default; + + //------------------------------------------------------------------ + /// This is currently intended to handle cases where a + /// program stops at an instruction that won't get executed and it + /// allows the stop reason, like "breakpoint hit", to be replaced + /// with a different stop reason like "no stop reason". + /// + /// This is specifically used for ARM in Thumb code when we stop in + /// an IT instruction (if/then/else) where the instruction won't get + /// executed and therefore it wouldn't be correct to show the program + /// stopped at the current PC. The code is generic and applies to all + /// ARM CPUs. + //------------------------------------------------------------------ + virtual void OverrideStopInfo(Thread &thread) = 0; + +private: + Architecture(const Architecture &) = delete; + void operator=(const Architecture &) = delete; +}; + +} // namespace lldb_private + +#endif // LLDB_CORE_ARCHITECTURE_H diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h index addc83ad5e9d1..fa5e6a636aaf2 100644 --- a/include/lldb/Core/Disassembler.h +++ b/include/lldb/Core/Disassembler.h @@ -11,7 +11,6 @@ #define liblldb_Disassembler_h_ #include "lldb/Core/Address.h" -#include "lldb/Core/ArchSpec.h" #include "lldb/Core/EmulateInstruction.h" #include "lldb/Core/FormatEntity.h" // for FormatEntity #include "lldb/Core/Opcode.h" @@ -19,7 +18,8 @@ #include "lldb/Interpreter/OptionValue.h" #include "lldb/Symbol/LineEntry.h" #include "lldb/Target/ExecutionContext.h" // for ExecutionContext -#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/ArchSpec.h" +#include "lldb/Utility/ConstString.h" // for ConstString #include "lldb/Utility/FileSpec.h" #include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN #include "lldb/lldb-enumerations.h" // for AddressClass, AddressClass... diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h index bfc9ef054d7a7..b0a4267a00a20 100644 --- a/include/lldb/Core/EmulateInstruction.h +++ b/include/lldb/Core/EmulateInstruction.h @@ -12,11 +12,10 @@ #include <string> -#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/Opcode.h" #include "lldb/Core/PluginInterface.h" - -#include "lldb/Core/Address.h" // for Address +#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 diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h index ebf56d7908b47..e8cfbade5c61e 100644 --- a/include/lldb/Core/IOHandler.h +++ b/include/lldb/Core/IOHandler.h @@ -195,7 +195,7 @@ public: enum class Completion { None, LLDBCommand, Expression }; IOHandlerDelegate(Completion completion = Completion::None) - : m_completion(completion), m_io_handler_done(false) {} + : m_completion(completion) {} virtual ~IOHandlerDelegate() = default; @@ -296,7 +296,6 @@ public: protected: Completion m_completion; // Support for common builtin completions - bool m_io_handler_done; }; //---------------------------------------------------------------------- diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h index 18d383ed581c7..d56a6d537868b 100644 --- a/include/lldb/Core/MappedHash.h +++ b/include/lldb/Core/MappedHash.h @@ -357,21 +357,24 @@ public: } uint32_t GetHashIndex(uint32_t bucket_idx) const { + uint32_t result = UINT32_MAX; if (m_hash_indexes && bucket_idx < m_header.bucket_count) - return m_hash_indexes[bucket_idx]; - return UINT32_MAX; + memcpy(&result, m_hash_indexes + bucket_idx, sizeof(uint32_t)); + return result; } uint32_t GetHashValue(uint32_t hash_idx) const { + uint32_t result = UINT32_MAX; if (m_hash_values && hash_idx < m_header.hashes_count) - return m_hash_values[hash_idx]; - return UINT32_MAX; + memcpy(&result, m_hash_values + hash_idx, sizeof(uint32_t)); + return result; } uint32_t GetHashDataOffset(uint32_t hash_idx) const { + uint32_t result = UINT32_MAX; if (m_hash_offsets && hash_idx < m_header.hashes_count) - return m_hash_offsets[hash_idx]; - return UINT32_MAX; + memcpy(&result, m_hash_offsets + hash_idx, sizeof(uint32_t)); + return result; } bool Find(const char *name, Pair &pair) const { diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 2ffe57ad8a4d7..da981ade78ba1 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -10,12 +10,12 @@ #ifndef liblldb_Module_h_ #define liblldb_Module_h_ -#include "lldb/Core/Address.h" // for Address -#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/ModuleSpec.h" // for ModuleSpec #include "lldb/Symbol/SymbolContextScope.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/PathMappingList.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/ConstString.h" // for ConstString #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" // for Status diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h index ce851d8af5fcf..cc95bd0a06385 100644 --- a/include/lldb/Core/ModuleSpec.h +++ b/include/lldb/Core/ModuleSpec.h @@ -11,8 +11,8 @@ #define liblldb_ModuleSpec_h_ // Project includes -#include "lldb/Core/ArchSpec.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" diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h index d9851e5ecfc1e..68e6ca20b2662 100644 --- a/include/lldb/Core/PluginManager.h +++ b/include/lldb/Core/PluginManager.h @@ -10,6 +10,7 @@ #ifndef liblldb_PluginManager_h_ #define liblldb_PluginManager_h_ +#include "lldb/Core/Architecture.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" // for Status #include "lldb/lldb-enumerations.h" // for ScriptLanguage @@ -54,6 +55,21 @@ public: GetABICreateCallbackForPluginName(const ConstString &name); //------------------------------------------------------------------ + // Architecture + //------------------------------------------------------------------ + using ArchitectureCreateInstance = + std::unique_ptr<Architecture> (*)(const ArchSpec &); + + static void RegisterPlugin(const ConstString &name, + llvm::StringRef description, + ArchitectureCreateInstance create_callback); + + static void UnregisterPlugin(ArchitectureCreateInstance create_callback); + + static std::unique_ptr<Architecture> + CreateArchitectureInstance(const ArchSpec &arch); + + //------------------------------------------------------------------ // Disassembler //------------------------------------------------------------------ static bool RegisterPlugin(const ConstString &name, const char *description, diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h index e37dcd7df4439..91fd409fb4eda 100644 --- a/include/lldb/Core/RangeMap.h +++ b/include/lldb/Core/RangeMap.h @@ -975,7 +975,6 @@ public: #endif if (!m_entries.empty()) { - typename Collection::const_iterator pos; for (const auto &entry : m_entries) { if (entry.Contains(addr)) indexes.push_back(entry.data); diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h index 0466693edbc49..2d5d6443ba7f4 100644 --- a/include/lldb/Core/Section.h +++ b/include/lldb/Core/Section.h @@ -238,7 +238,7 @@ public: /// section has no data or \a offset is not a valid offset /// in this section. //------------------------------------------------------------------ - lldb::offset_t GetSectionData(DataExtractor &data) const; + lldb::offset_t GetSectionData(DataExtractor &data); uint32_t GetLog2Align() { return m_log2align; } @@ -247,6 +247,10 @@ public: // Get the number of host bytes required to hold a target byte uint32_t GetTargetByteSize() const { return m_target_byte_size; } + bool IsRelocated() const { return m_relocated; } + + void SetIsRelocated(bool b) { m_relocated = b; } + protected: ObjectFile *m_obj_file; // The object file that data for this section should // be read from @@ -274,7 +278,8 @@ protected: m_thread_specific : 1, // This section is thread specific m_readable : 1, // If this section has read permissions m_writable : 1, // If this section has write permissions - m_executable : 1; // If this section has executable permissions + m_executable : 1, // If this section has executable permissions + m_relocated : 1; // If this section has had relocations applied uint32_t m_target_byte_size; // Some architectures have non-8-bit byte size. // This is specified as // as a multiple number of a host bytes diff --git a/include/lldb/Expression/DWARFExpression.h b/include/lldb/Expression/DWARFExpression.h index 1816c3b7a00f4..c85aaa5c1f9a8 100644 --- a/include/lldb/Expression/DWARFExpression.h +++ b/include/lldb/Expression/DWARFExpression.h @@ -22,10 +22,6 @@ class DWARFCompileUnit; namespace lldb_private { -class ClangExpressionDeclMap; -class ClangExpressionVariable; -class ClangExpressionVariableList; - //---------------------------------------------------------------------- /// @class DWARFExpression DWARFExpression.h "lldb/Expression/DWARFExpression.h" /// @brief Encapsulates a DWARF location expression and interprets it. @@ -262,8 +258,6 @@ public: /// member variables to populate many operands //------------------------------------------------------------------ bool Evaluate(ExecutionContextScope *exe_scope, - ClangExpressionVariableList *expr_locals, - ClangExpressionDeclMap *decl_map, lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, Value &result, Status *error_ptr) const; @@ -272,9 +266,7 @@ public: /// Wrapper for the static evaluate function that uses member /// variables to populate many operands //------------------------------------------------------------------ - bool Evaluate(ExecutionContext *exe_ctx, - ClangExpressionVariableList *expr_locals, - ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, + bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, Value &result, Status *error_ptr) const; @@ -338,32 +330,14 @@ public: /// True on success; false otherwise. If error_ptr is non-NULL, /// details of the failure are provided through it. //------------------------------------------------------------------ - static bool - Evaluate(ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals, - ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, - lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes, - DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset, - const lldb::offset_t length, const lldb::RegisterKind reg_set, - const Value *initial_value_ptr, const Value *object_address_ptr, - Value &result, Status *error_ptr); - - //------------------------------------------------------------------ - /// Loads a ClangExpressionVariableList into the object - /// - /// @param[in] locals - /// If non-NULL, the list of locals used by this expression. - /// See Evaluate(). - //------------------------------------------------------------------ - void SetExpressionLocalVariableList(ClangExpressionVariableList *locals); - - //------------------------------------------------------------------ - /// Loads a ClangExpressionDeclMap into the object - /// - /// @param[in] locals - /// If non-NULL, the list of external variables used by this - /// expression. See Evaluate(). - //------------------------------------------------------------------ - void SetExpressionDeclMap(ClangExpressionDeclMap *decl_map); + static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, + lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes, + DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset, + const lldb::offset_t length, + const lldb::RegisterKind reg_set, + const Value *initial_value_ptr, + const Value *object_address_ptr, Value &result, + Status *error_ptr); bool GetExpressionData(DataExtractor &data) const { data = m_data; diff --git a/include/lldb/Expression/ExpressionParser.h b/include/lldb/Expression/ExpressionParser.h index 19526d28b9b35..a550d576f4376 100644 --- a/include/lldb/Expression/ExpressionParser.h +++ b/include/lldb/Expression/ExpressionParser.h @@ -11,6 +11,7 @@ #define liblldb_ExpressionParser_h_ #include "lldb/Utility/Status.h" +#include "lldb/lldb-private-enumerations.h" #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/include/lldb/Expression/IRExecutionUnit.h b/include/lldb/Expression/IRExecutionUnit.h index b0b4d7a5c586c..703fcd152af41 100644 --- a/include/lldb/Expression/IRExecutionUnit.h +++ b/include/lldb/Expression/IRExecutionUnit.h @@ -421,8 +421,8 @@ private: lldb::addr_t m_function_load_addr; lldb::addr_t m_function_end_load_addr; - bool m_strip_underscore; ///< True for platforms where global symbols have a _ - ///prefix + bool m_strip_underscore = true; ///< True for platforms where global symbols + /// have a _ prefix bool m_reported_allocations; ///< True after allocations have been reported. ///It is possible that ///< sections will be allocated when this is true, in which case they weren't diff --git a/include/lldb/Host/Config.h.cmake b/include/lldb/Host/Config.h.cmake index 0deedd151a5eb..73f4b8f6cc4ab 100644 --- a/include/lldb/Host/Config.h.cmake +++ b/include/lldb/Host/Config.h.cmake @@ -24,4 +24,6 @@ #cmakedefine01 HAVE_NR_PROCESS_VM_READV +#cmakedefine HAVE_LIBCOMPRESSION + #endif // #ifndef LLDB_HOST_CONFIG_H diff --git a/include/lldb/Host/Host.h b/include/lldb/Host/Host.h index da0b8e14c4a7a..f099c72381be7 100644 --- a/include/lldb/Host/Host.h +++ b/include/lldb/Host/Host.h @@ -48,6 +48,12 @@ struct WaitStatus { static WaitStatus Decode(int wstatus); }; +inline bool operator==(WaitStatus a, WaitStatus b) { + return a.type == b.type && a.status == b.status; +} + +inline bool operator!=(WaitStatus a, WaitStatus b) { return !(a == b); } + //---------------------------------------------------------------------- /// @class Host Host.h "lldb/Host/Host.h" /// @brief A class that provides host computer information. diff --git a/include/lldb/Host/HostInfoBase.h b/include/lldb/Host/HostInfoBase.h index 42e3fc3fd1da0..52648d2031fce 100644 --- a/include/lldb/Host/HostInfoBase.h +++ b/include/lldb/Host/HostInfoBase.h @@ -10,7 +10,7 @@ #ifndef lldb_Host_HostInfoBase_h_ #define lldb_Host_HostInfoBase_h_ -#include "lldb/Core/ArchSpec.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" #include "lldb/lldb-enumerations.h" @@ -61,6 +61,8 @@ public: static const ArchSpec & GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault); + static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind); + //------------------------------------------------------------------ /// Find a resource files that are related to LLDB. /// @@ -81,6 +83,13 @@ public: //------------------------------------------------------------------ static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec); + //--------------------------------------------------------------------------- + /// If the triple does not specify the vendor, os, and environment parts, we + /// "augment" these using information from the host and return the resulting + /// ArchSpec object. + //--------------------------------------------------------------------------- + static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple); + protected: static bool ComputeSharedLibraryDirectory(FileSpec &file_spec); static bool ComputeSupportExeDirectory(FileSpec &file_spec); diff --git a/include/lldb/Host/MainLoop.h b/include/lldb/Host/MainLoop.h index 5ac145ff865b6..c59a5aa5b0e83 100644 --- a/include/lldb/Host/MainLoop.h +++ b/include/lldb/Host/MainLoop.h @@ -15,7 +15,7 @@ #include "llvm/ADT/DenseMap.h" #include <csignal> -#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H +#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H && !defined(__ANDROID__) #define SIGNAL_POLLING_UNSUPPORTED 1 #endif diff --git a/include/lldb/Host/PseudoTerminal.h b/include/lldb/Host/PseudoTerminal.h index fdbf6df1a1864..00c0da6f33154 100644 --- a/include/lldb/Host/PseudoTerminal.h +++ b/include/lldb/Host/PseudoTerminal.h @@ -9,14 +9,13 @@ #ifndef LLDB_HOST_PSEUDOTERMINAL_H #define LLDB_HOST_PSEUDOTERMINAL_H -#if defined(__cplusplus) #include <fcntl.h> #include <string> #include "lldb/lldb-defines.h" -namespace lldb_utility { +namespace lldb_private { //---------------------------------------------------------------------- /// @class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h" @@ -246,7 +245,6 @@ private: DISALLOW_COPY_AND_ASSIGN(PseudoTerminal); }; -} // namespace lldb_utility +} // namespace lldb_private -#endif // #if defined(__cplusplus) #endif // #ifndef liblldb_PseudoTerminal_h_ diff --git a/include/lldb/Utility/TaskPool.h b/include/lldb/Host/TaskPool.h index f2deaee506b8a..13076e7eb70bd 100644 --- a/include/lldb/Utility/TaskPool.h +++ b/include/lldb/Host/TaskPool.h @@ -18,6 +18,8 @@ #include <mutex> // for mutex, unique_lock, condition_variable #include <type_traits> // for forward, result_of, move +namespace lldb_private { + // Global TaskPool class for running tasks in parallel on a set of worker thread // created the first // time the task pool is used. The TaskPool provide no guarantee about the order @@ -89,4 +91,8 @@ template <> struct TaskPool::RunTaskImpl<> { void TaskMapOverInt(size_t begin, size_t end, const llvm::function_ref<void(size_t)> &func); +unsigned GetHardwareConcurrencyHint(); + +} // namespace lldb_private + #endif // #ifndef utility_TaskPool_h_ diff --git a/include/lldb/Host/common/NativeProcessProtocol.h b/include/lldb/Host/common/NativeProcessProtocol.h index 9671d710fc024..bd8b8744b115d 100644 --- a/include/lldb/Host/common/NativeProcessProtocol.h +++ b/include/lldb/Host/common/NativeProcessProtocol.h @@ -10,8 +10,12 @@ #ifndef liblldb_NativeProcessProtocol_h_ #define liblldb_NativeProcessProtocol_h_ +#include "NativeBreakpointList.h" +#include "NativeThreadProtocol.h" +#include "NativeWatchpointList.h" #include "lldb/Host/Host.h" #include "lldb/Host/MainLoop.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/TraceOptions.h" #include "lldb/lldb-private-forward.h" @@ -23,9 +27,6 @@ #include "llvm/Support/MemoryBuffer.h" #include <vector> -#include "NativeBreakpointList.h" -#include "NativeWatchpointList.h" - namespace lldb_private { class MemoryRegionInfo; class ResumeActionList; @@ -100,7 +101,7 @@ public: virtual size_t UpdateThreads() = 0; - virtual bool GetArchitecture(ArchSpec &arch) const = 0; + virtual const ArchSpec &GetArchitecture() const = 0; //---------------------------------------------------------------------- // Breakpoint functions @@ -151,7 +152,9 @@ public: bool CanResume() const { return m_state == lldb::eStateStopped; } - bool GetByteOrder(lldb::ByteOrder &byte_order) const; + lldb::ByteOrder GetByteOrder() const { + return GetArchitecture().GetByteOrder(); + } virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> GetAuxvData() const = 0; @@ -166,15 +169,15 @@ public: //---------------------------------------------------------------------- // Access to threads //---------------------------------------------------------------------- - NativeThreadProtocolSP GetThreadAtIndex(uint32_t idx); + NativeThreadProtocol *GetThreadAtIndex(uint32_t idx); - NativeThreadProtocolSP GetThreadByID(lldb::tid_t tid); + NativeThreadProtocol *GetThreadByID(lldb::tid_t tid); void SetCurrentThreadID(lldb::tid_t tid) { m_current_thread_id = tid; } lldb::tid_t GetCurrentThreadID() { return m_current_thread_id; } - NativeThreadProtocolSP GetCurrentThread() { + NativeThreadProtocol *GetCurrentThread() { return GetThreadByID(m_current_thread_id); } @@ -401,7 +404,7 @@ public: protected: lldb::pid_t m_pid; - std::vector<NativeThreadProtocolSP> m_threads; + std::vector<std::unique_ptr<NativeThreadProtocol>> m_threads; lldb::tid_t m_current_thread_id = LLDB_INVALID_THREAD_ID; mutable std::recursive_mutex m_threads_mutex; @@ -461,7 +464,7 @@ protected: // ----------------------------------------------------------- void NotifyDidExec(); - NativeThreadProtocolSP GetThreadByIDUnlocked(lldb::tid_t tid); + NativeThreadProtocol *GetThreadByIDUnlocked(lldb::tid_t tid); // ----------------------------------------------------------- // Static helper methods for derived classes. diff --git a/include/lldb/Host/common/NativeRegisterContext.h b/include/lldb/Host/common/NativeRegisterContext.h index 982d81b9ac4cf..a8c5fa17e2643 100644 --- a/include/lldb/Host/common/NativeRegisterContext.h +++ b/include/lldb/Host/common/NativeRegisterContext.h @@ -27,8 +27,7 @@ public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ - NativeRegisterContext(NativeThreadProtocol &thread, - uint32_t concrete_frame_idx); + NativeRegisterContext(NativeThreadProtocol &thread); virtual ~NativeRegisterContext(); @@ -184,8 +183,6 @@ protected: //------------------------------------------------------------------ NativeThreadProtocol &m_thread; // The thread that this register context belongs to. - uint32_t m_concrete_frame_idx; // The concrete frame index for this register - // context // uint32_t m_stop_id; // The stop ID that any data in this // context is valid for diff --git a/include/lldb/Host/common/NativeThreadProtocol.h b/include/lldb/Host/common/NativeThreadProtocol.h index d96f713111856..5609cdda4eeab 100644 --- a/include/lldb/Host/common/NativeThreadProtocol.h +++ b/include/lldb/Host/common/NativeThreadProtocol.h @@ -20,8 +20,7 @@ namespace lldb_private { //------------------------------------------------------------------ // NativeThreadProtocol //------------------------------------------------------------------ -class NativeThreadProtocol - : public std::enable_shared_from_this<NativeThreadProtocol> { +class NativeThreadProtocol { public: NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid); @@ -31,7 +30,7 @@ public: virtual lldb::StateType GetState() = 0; - virtual NativeRegisterContextSP GetRegisterContext() = 0; + virtual NativeRegisterContext &GetRegisterContext() = 0; virtual Status ReadRegister(uint32_t reg, RegisterValue ®_value); diff --git a/include/lldb/Interpreter/Args.h b/include/lldb/Interpreter/Args.h index 98046cd595454..19d7ac4185665 100644 --- a/include/lldb/Interpreter/Args.h +++ b/include/lldb/Interpreter/Args.h @@ -86,6 +86,7 @@ public: Args(llvm::StringRef command = llvm::StringRef()); Args(const Args &rhs); + explicit Args(const StringList &list); Args &operator=(const Args &rhs); diff --git a/include/lldb/Interpreter/CommandInterpreter.h b/include/lldb/Interpreter/CommandInterpreter.h index 73bd7d6e6220d..5e561f47946d7 100644 --- a/include/lldb/Interpreter/CommandInterpreter.h +++ b/include/lldb/Interpreter/CommandInterpreter.h @@ -242,6 +242,8 @@ public: bool repeat_on_empty_command = true, bool no_context_switching = false); + bool WasInterrupted() const; + //------------------------------------------------------------------ /// Execute a list of commands in sequence. /// @@ -522,6 +524,25 @@ private: StringList &commands_help, CommandObject::CommandMap &command_map); + // An interruptible wrapper around the stream output + void PrintCommandOutput(Stream &stream, llvm::StringRef str); + + // A very simple state machine which models the command handling transitions + enum class CommandHandlingState { + eIdle, + eInProgress, + eInterrupted, + }; + + std::atomic<CommandHandlingState> m_command_state{ + CommandHandlingState::eIdle}; + + int m_iohandler_nesting_level = 0; + + void StartHandlingCommand(); + void FinishHandlingCommand(); + bool InterruptCommand(); + Debugger &m_debugger; // The debugger session that this interpreter is // associated with ExecutionContextRef m_exe_ctx_ref; // The current execution context to use diff --git a/include/lldb/Interpreter/OptionGroupArchitecture.h b/include/lldb/Interpreter/OptionGroupArchitecture.h index e73a53421f289..2cecaa65a0fdc 100644 --- a/include/lldb/Interpreter/OptionGroupArchitecture.h +++ b/include/lldb/Interpreter/OptionGroupArchitecture.h @@ -10,12 +10,8 @@ #ifndef liblldb_OptionGroupArchitecture_h_ #define liblldb_OptionGroupArchitecture_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ArchSpec.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Utility/ArchSpec.h" namespace lldb_private { diff --git a/include/lldb/Interpreter/OptionValueArch.h b/include/lldb/Interpreter/OptionValueArch.h index e1a354d4ae21e..d66448aa2bedf 100644 --- a/include/lldb/Interpreter/OptionValueArch.h +++ b/include/lldb/Interpreter/OptionValueArch.h @@ -10,12 +10,8 @@ #ifndef liblldb_OptionValueArch_h_ #define liblldb_OptionValueArch_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ArchSpec.h" #include "lldb/Interpreter/OptionValue.h" +#include "lldb/Utility/ArchSpec.h" namespace lldb_private { diff --git a/include/lldb/Symbol/ArmUnwindInfo.h b/include/lldb/Symbol/ArmUnwindInfo.h index ef67a31e7d0d2..422408b034c6e 100644 --- a/include/lldb/Symbol/ArmUnwindInfo.h +++ b/include/lldb/Symbol/ArmUnwindInfo.h @@ -31,7 +31,7 @@ namespace lldb_private { class ArmUnwindInfo { public: - ArmUnwindInfo(const ObjectFile &objfile, lldb::SectionSP &arm_exidx, + ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx, lldb::SectionSP &arm_extab); ~ArmUnwindInfo(); diff --git a/include/lldb/Symbol/ClangASTContext.h b/include/lldb/Symbol/ClangASTContext.h index 9d0a08414e93f..2d2c804eb0250 100644 --- a/include/lldb/Symbol/ClangASTContext.h +++ b/include/lldb/Symbol/ClangASTContext.h @@ -25,6 +25,7 @@ // Other libraries and framework includes #include "clang/AST/ASTContext.h" +#include "clang/AST/ExternalASTMerger.h" #include "clang/AST/TemplateBase.h" #include "llvm/ADT/SmallVector.h" @@ -396,7 +397,8 @@ public: CompilerType CreateEnumerationType(const char *name, clang::DeclContext *decl_ctx, const Declaration &decl, - const CompilerType &integer_qual_type); + const CompilerType &integer_qual_type, + bool is_scoped); //------------------------------------------------------------------ // Integer type functions @@ -780,9 +782,14 @@ public: size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override; - CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx, - lldb::TemplateArgumentKind &kind) override; + lldb::TemplateArgumentKind + GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, + size_t idx) override; + CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, + size_t idx) override; + llvm::Optional<CompilerType::IntegralTemplateArgument> + GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, + size_t idx) override; CompilerType GetTypeForFormatters(void *type) override; @@ -964,8 +971,14 @@ public: clang::DeclarationName GetDeclarationName(const char *name, const CompilerType &function_clang_type); - + + virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() { + return m_origins; + } protected: + const clang::ClassTemplateSpecializationDecl * + GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type); + //------------------------------------------------------------------ // Classes that inherit from ClangASTContext can see and modify these //------------------------------------------------------------------ @@ -990,6 +1003,7 @@ protected: CompleteTagDeclCallback m_callback_tag_decl; CompleteObjCInterfaceDeclCallback m_callback_objc_decl; void * m_callback_baton; + clang::ExternalASTMerger::OriginMap m_origins; uint32_t m_pointer_byte_size; bool m_ast_owned; bool m_can_evaluate_expressions; @@ -1023,7 +1037,12 @@ public: const char *name) override; PersistentExpressionState *GetPersistentExpressionState() override; - + + clang::ExternalASTMerger &GetMergerUnchecked(); + + const clang::ExternalASTMerger::OriginMap &GetOriginMap() override { + return GetMergerUnchecked().GetOrigins(); + } private: lldb::TargetWP m_target_wp; lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the diff --git a/include/lldb/Symbol/CompilerType.h b/include/lldb/Symbol/CompilerType.h index c5bca54ed43f7..70d56db7fc21b 100644 --- a/include/lldb/Symbol/CompilerType.h +++ b/include/lldb/Symbol/CompilerType.h @@ -20,6 +20,7 @@ // Project includes #include "lldb/Core/ClangForward.h" #include "lldb/lldb-private.h" +#include "llvm/ADT/APSInt.h" namespace lldb_private { @@ -290,6 +291,8 @@ public: // Exploring the type //---------------------------------------------------------------------- + struct IntegralTemplateArgument; + uint64_t GetByteSize(ExecutionContextScope *exe_scope) const; uint64_t GetBitSize(ExecutionContextScope *exe_scope) const; @@ -365,8 +368,12 @@ public: size_t GetNumTemplateArguments() const; - CompilerType GetTemplateArgument(size_t idx, - lldb::TemplateArgumentKind &kind) const; + lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx) const; + CompilerType GetTypeTemplateArgument(size_t idx) const; + + // Returns the value of the template argument and its type. + llvm::Optional<IntegralTemplateArgument> + GetIntegralTemplateArgument(size_t idx) const; CompilerType GetTypeForFormatters() const; @@ -429,6 +436,11 @@ private: bool operator==(const CompilerType &lhs, const CompilerType &rhs); bool operator!=(const CompilerType &lhs, const CompilerType &rhs); +struct CompilerType::IntegralTemplateArgument { + llvm::APSInt value; + CompilerType type; +}; + } // namespace lldb_private #endif // liblldb_CompilerType_h_ diff --git a/include/lldb/Symbol/DeclVendor.h b/include/lldb/Symbol/DeclVendor.h index 16d514fdf1bdd..f0ce9157cfa5c 100644 --- a/include/lldb/Symbol/DeclVendor.h +++ b/include/lldb/Symbol/DeclVendor.h @@ -13,6 +13,8 @@ #include "lldb/Core/ClangForward.h" #include "lldb/lldb-defines.h" +#include "clang/AST/ExternalASTMerger.h" + #include <vector> namespace lldb_private { @@ -53,6 +55,15 @@ public: uint32_t max_matches, std::vector<clang::NamedDecl *> &decls) = 0; + //------------------------------------------------------------------ + /// Interface for ExternalASTMerger. Returns an ImporterSource + /// allowing type completion. + /// + /// @return + /// An ImporterSource for this DeclVendor. + //------------------------------------------------------------------ + virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0; + private: //------------------------------------------------------------------ // For DeclVendor only diff --git a/include/lldb/Symbol/FuncUnwinders.h b/include/lldb/Symbol/FuncUnwinders.h index 64c222cce5857..27f42cf425b2e 100644 --- a/include/lldb/Symbol/FuncUnwinders.h +++ b/include/lldb/Symbol/FuncUnwinders.h @@ -1,13 +1,11 @@ #ifndef liblldb_FuncUnwinders_h #define liblldb_FuncUnwinders_h +#include "lldb/Core/AddressRange.h" +#include "lldb/lldb-private-enumerations.h" #include <mutex> #include <vector> -#include "lldb/Core/AddressRange.h" -#include "lldb/Core/AddressRange.h" -#include "lldb/Core/ArchSpec.h" - namespace lldb_private { class UnwindTable; diff --git a/include/lldb/Symbol/GoASTContext.h b/include/lldb/Symbol/GoASTContext.h index 6feac7abf1622..ee111942c2052 100644 --- a/include/lldb/Symbol/GoASTContext.h +++ b/include/lldb/Symbol/GoASTContext.h @@ -315,12 +315,6 @@ public: return 0; } - CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx, - lldb::TemplateArgumentKind &kind) override { - return CompilerType(); - } - //---------------------------------------------------------------------- // Dumping types //---------------------------------------------------------------------- diff --git a/include/lldb/Symbol/JavaASTContext.h b/include/lldb/Symbol/JavaASTContext.h index 4fdd2371b67ee..41a881dcf4eb4 100644 --- a/include/lldb/Symbol/JavaASTContext.h +++ b/include/lldb/Symbol/JavaASTContext.h @@ -203,10 +203,6 @@ public: size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override; - CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx, - lldb::TemplateArgumentKind &kind) override; - int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override; CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, diff --git a/include/lldb/Symbol/OCamlASTContext.h b/include/lldb/Symbol/OCamlASTContext.h index a261d43519e0c..7144886e1c756 100644 --- a/include/lldb/Symbol/OCamlASTContext.h +++ b/include/lldb/Symbol/OCamlASTContext.h @@ -231,12 +231,6 @@ public: return 0; } - CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type, - size_t idx, - lldb::TemplateArgumentKind &kind) override { - return CompilerType(); - } - void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, lldb::Format format, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, diff --git a/include/lldb/Symbol/ObjectFile.h b/include/lldb/Symbol/ObjectFile.h index a4c7b01ece176..3f9250af7e08a 100644 --- a/include/lldb/Symbol/ObjectFile.h +++ b/include/lldb/Symbol/ObjectFile.h @@ -352,6 +352,12 @@ public: virtual Symtab *GetSymtab() = 0; //------------------------------------------------------------------ + /// Perform relocations on the section if necessary. + /// + //------------------------------------------------------------------ + virtual void RelocateSection(lldb_private::Section *section); + + //------------------------------------------------------------------ /// Appends a Symbol for the specified so_addr to the symbol table. /// /// If verify_unique is false, the symbol table is not searched @@ -787,20 +793,26 @@ public: static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp, lldb::addr_t addr, size_t byte_size); + // This function returns raw file contents. Do not use it if you want + // transparent decompression of section contents. size_t GetData(lldb::offset_t offset, size_t length, DataExtractor &data) const; + // This function returns raw file contents. Do not use it if you want + // transparent decompression of section contents. size_t CopyData(lldb::offset_t offset, size_t length, void *dst) const; - virtual size_t ReadSectionData(const Section *section, + // This function will transparently decompress section data if the section if + // compressed. + virtual size_t ReadSectionData(Section *section, lldb::offset_t section_offset, void *dst, - size_t dst_len) const; - - virtual size_t ReadSectionData(const Section *section, - DataExtractor §ion_data) const; + size_t dst_len); - size_t MemoryMapSectionData(const Section *section, - DataExtractor §ion_data) const; + // This function will transparently decompress section data if the section if + // compressed. Note that for compressed section the resulting data size may be + // larger than what Section::GetFileSize reports. + virtual size_t ReadSectionData(Section *section, + DataExtractor §ion_data); bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; } diff --git a/include/lldb/Symbol/TypeSystem.h b/include/lldb/Symbol/TypeSystem.h index b4f84c0dd67cc..ff85d84287465 100644 --- a/include/lldb/Symbol/TypeSystem.h +++ b/include/lldb/Symbol/TypeSystem.h @@ -351,9 +351,12 @@ public: virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) = 0; - virtual CompilerType - GetTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, - lldb::TemplateArgumentKind &kind) = 0; + virtual lldb::TemplateArgumentKind + GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx); + virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, + size_t idx); + virtual llvm::Optional<CompilerType::IntegralTemplateArgument> + GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx); //---------------------------------------------------------------------- // Dumping types diff --git a/include/lldb/Target/Platform.h b/include/lldb/Target/Platform.h index cc007d959c655..6288a3ab684ff 100644 --- a/include/lldb/Target/Platform.h +++ b/include/lldb/Target/Platform.h @@ -21,10 +21,10 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ArchSpec.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private-forward.h" @@ -53,6 +53,7 @@ public: }; typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP; +typedef llvm::SmallVector<lldb::addr_t, 6> MmapArgList; //---------------------------------------------------------------------- /// @class Platform Platform.h "lldb/Target/Platform.h" @@ -116,9 +117,12 @@ public: static lldb::PlatformSP Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr, Status &error); - static uint32_t GetNumConnectedRemotePlatforms(); - - static lldb::PlatformSP GetConnectedRemotePlatformAtIndex(uint32_t idx); + //------------------------------------------------------------------------ + /// Augments the triple either with information from platform or the host + /// system (if platform is null). + //------------------------------------------------------------------------ + static ArchSpec GetAugmentedArchSpec(Platform *platform, + llvm::StringRef triple); //------------------------------------------------------------------ /// Find a platform plugin for a given process. @@ -512,6 +516,13 @@ public: m_os_version_set_while_connected = m_system_arch.IsValid(); } + //--------------------------------------------------------------------------- + /// If the triple contains not specify the vendor, os, and environment parts, + /// we "augment" these using information from the platform and return the + /// resulting ArchSpec object. + //--------------------------------------------------------------------------- + ArchSpec GetAugmentedArchSpec(llvm::StringRef triple); + // Used for column widths size_t GetMaxUserIDNameLength() const { return m_max_uid_name_len; } @@ -628,8 +639,11 @@ public: virtual Status Unlink(const FileSpec &file_spec); - virtual uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, - unsigned flags); + virtual MmapArgList GetMmapArgumentList(const ArchSpec &arch, + lldb::addr_t addr, + lldb::addr_t length, + unsigned prot, unsigned flags, + lldb::addr_t fd, lldb::addr_t offset); virtual bool GetSupportsRSync() { return m_supports_rsync; } diff --git a/include/lldb/Target/Process.h b/include/lldb/Target/Process.h index df09570057a13..16f37f4dd5dcb 100644 --- a/include/lldb/Target/Process.h +++ b/include/lldb/Target/Process.h @@ -27,7 +27,6 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointSiteList.h" -#include "lldb/Core/ArchSpec.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Communication.h" #include "lldb/Core/Event.h" @@ -46,6 +45,7 @@ #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/QueueList.h" #include "lldb/Target/ThreadList.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/StructuredData.h" @@ -99,6 +99,8 @@ public: bool GetWarningsOptimization() const; + bool GetStopOnExec() const; + protected: static void OptionValueChangedCallback(void *baton, OptionValue *option_value); @@ -2514,10 +2516,6 @@ public: OperatingSystem *GetOperatingSystem() { return m_os_ap.get(); } - ArchSpec::StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const { - return m_stop_info_override_callback; - } - virtual LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language, bool retry_if_null = true); @@ -3106,7 +3104,6 @@ protected: std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions; ProcessRunLock m_public_run_lock; ProcessRunLock m_private_run_lock; - ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback; bool m_currently_handling_do_on_removals; bool m_resume_requested; // If m_currently_handling_event or // m_currently_handling_do_on_removals are true, diff --git a/include/lldb/Target/ProcessInfo.h b/include/lldb/Target/ProcessInfo.h index 03b15242f7eef..4077abf89baf8 100644 --- a/include/lldb/Target/ProcessInfo.h +++ b/include/lldb/Target/ProcessInfo.h @@ -11,8 +11,8 @@ #define liblldb_ProcessInfo_h_ // LLDB headers -#include "lldb/Core/ArchSpec.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" namespace lldb_private { diff --git a/include/lldb/Target/ProcessLaunchInfo.h b/include/lldb/Target/ProcessLaunchInfo.h index 93a1a9ebd2391..fc715f28544d1 100644 --- a/include/lldb/Target/ProcessLaunchInfo.h +++ b/include/lldb/Target/ProcessLaunchInfo.h @@ -117,7 +117,7 @@ public: bool MonitorProcess() const; - lldb_utility::PseudoTerminal &GetPTY() { return *m_pty; } + PseudoTerminal &GetPTY() { return *m_pty; } // Get and set the actual listener that will be used for the process events lldb::ListenerSP GetListener() const { return m_listener_sp; } @@ -150,7 +150,7 @@ protected: FileSpec m_shell; Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags std::vector<FileAction> m_file_actions; // File actions for any other files - std::shared_ptr<lldb_utility::PseudoTerminal> m_pty; + std::shared_ptr<PseudoTerminal> m_pty; uint32_t m_resume_count; // How many times do we resume after launching Host::MonitorChildProcessCallback m_monitor_callback; void *m_monitor_callback_baton; diff --git a/include/lldb/Target/Target.h b/include/lldb/Target/Target.h index ff9451939909a..242ec14165ebf 100644 --- a/include/lldb/Target/Target.h +++ b/include/lldb/Target/Target.h @@ -21,8 +21,9 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointList.h" +#include "lldb/Breakpoint/BreakpointName.h" #include "lldb/Breakpoint/WatchpointList.h" -#include "lldb/Core/ArchSpec.h" +#include "lldb/Core/Architecture.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/ModuleList.h" @@ -33,6 +34,7 @@ #include "lldb/Target/PathMappingList.h" #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/SectionLoadHistory.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/Timeout.h" #include "lldb/lldb-public.h" @@ -195,6 +197,8 @@ public: void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b); + bool GetUseModernTypeLookup() const; + private: //------------------------------------------------------------------ // Callbacks for m_launch_info. @@ -651,12 +655,45 @@ public: } WatchpointList &GetWatchpointList() { return m_watchpoint_list; } - + + // Manages breakpoint names: + void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error); + + void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name, + Status &error); + + void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp, + const ConstString &name); + + BreakpointName *FindBreakpointName(const ConstString &name, bool can_create, + Status &error); + + void DeleteBreakpointName(const ConstString &name); + + void ConfigureBreakpointName(BreakpointName &bp_name, + const BreakpointOptions &options, + const BreakpointName::Permissions &permissions); + void ApplyNameToBreakpoints(BreakpointName &bp_name); + + + // This takes ownership of the name obj passed in. + void AddBreakpointName(BreakpointName *bp_name); + + void GetBreakpointNames(std::vector<std::string> &names); + + //This call removes ALL breakpoints regardless of permission. void RemoveAllBreakpoints(bool internal_also = false); + + // This removes all the breakpoints, but obeys the ePermDelete on them. + void RemoveAllowedBreakpoints(); void DisableAllBreakpoints(bool internal_also = false); + + void DisableAllowedBreakpoints(); void EnableAllBreakpoints(bool internal_also = false); + + void EnableAllowedBreakpoints(); bool DisableBreakpointByID(lldb::break_id_t break_id); @@ -881,7 +918,7 @@ public: bool ModuleIsExcludedForUnconstrainedSearches(const lldb::ModuleSP &module_sp); - const ArchSpec &GetArchitecture() const { return m_arch; } + const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); } //------------------------------------------------------------------ /// Set the architecture for this target. @@ -912,6 +949,8 @@ public: bool MergeArchitecture(const ArchSpec &arch_spec); + Architecture *GetArchitecturePlugin() { return m_arch.GetPlugin(); } + Debugger &GetDebugger() { return m_debugger; } size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, @@ -1205,6 +1244,18 @@ protected: const lldb::ModuleSP &new_module_sp) override; void WillClearList(const ModuleList &module_list) override; + class Arch { + public: + explicit Arch(const ArchSpec &spec); + const Arch &operator=(const ArchSpec &spec); + + const ArchSpec &GetSpec() const { return m_spec; } + Architecture *GetPlugin() const { return m_plugin_up.get(); } + + private: + ArchSpec m_spec; + std::unique_ptr<Architecture> m_plugin_up; + }; //------------------------------------------------------------------ // Member variables. //------------------------------------------------------------------ @@ -1212,12 +1263,15 @@ protected: lldb::PlatformSP m_platform_sp; ///< The platform for this target. std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB* /// classes make the SB interface thread safe - ArchSpec m_arch; + Arch m_arch; ModuleList m_images; ///< The list of images for this process (shared /// libraries and anything dynamically loaded). SectionLoadHistory m_section_load_history; BreakpointList m_breakpoint_list; BreakpointList m_internal_breakpoint_list; + using BreakpointNameList = std::map<ConstString, BreakpointName *>; + BreakpointNameList m_breakpoint_names; + lldb::BreakpointSP m_last_created_breakpoint; WatchpointList m_watchpoint_list; lldb::WatchpointSP m_last_created_watchpoint; diff --git a/include/lldb/Target/UnwindAssembly.h b/include/lldb/Target/UnwindAssembly.h index 66fc27f71aa1a..3028ffeaa51d3 100644 --- a/include/lldb/Target/UnwindAssembly.h +++ b/include/lldb/Target/UnwindAssembly.h @@ -10,8 +10,8 @@ #ifndef utility_UnwindAssembly_h_ #define utility_UnwindAssembly_h_ -#include "lldb/Core/ArchSpec.h" #include "lldb/Core/PluginInterface.h" +#include "lldb/Utility/ArchSpec.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/include/lldb/Core/ArchSpec.h b/include/lldb/Utility/ArchSpec.h index 75c7079be08d7..50f69606e3df3 100644 --- a/include/lldb/Core/ArchSpec.h +++ b/include/lldb/Utility/ArchSpec.h @@ -7,39 +7,23 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_ArchSpec_h_ -#define liblldb_ArchSpec_h_ - -#if defined(__cplusplus) +#ifndef LLDB_UTILITY_ARCHSPEC_H +#define LLDB_UTILITY_ARCHSPEC_H #include "lldb/Utility/ConstString.h" #include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" #include "lldb/lldb-private-enumerations.h" #include "llvm/ADT/StringRef.h" // for StringRef #include "llvm/ADT/Triple.h" - -#include <string> // for string - -#include <stddef.h> // for size_t -#include <stdint.h> // for uint32_t - -namespace lldb_private { -class Platform; -} -namespace lldb_private { -class Stream; -} -namespace lldb_private { -class StringList; -} -namespace lldb_private { -class Thread; -} +#include <cstddef> // for size_t +#include <cstdint> // for uint32_t +#include <string> // for string namespace lldb_private { //---------------------------------------------------------------------- -/// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h" +/// @class ArchSpec ArchSpec.h "lldb/Utility/ArchSpec.h" /// @brief An architecture specification class. /// /// A class designed to be created from a cpu type and subtype, a @@ -177,6 +161,7 @@ public: eCore_ppc_ppc7450, eCore_ppc_ppc970, + eCore_ppc64le_generic, eCore_ppc64_generic, eCore_ppc64_ppc970_64, @@ -257,8 +242,6 @@ public: }; - typedef void (*StopInfoOverrideCallbackType)(lldb_private::Thread &thread); - //------------------------------------------------------------------ /// Default constructor. /// @@ -276,8 +259,6 @@ public: explicit ArchSpec(const llvm::Triple &triple); explicit ArchSpec(const char *triple_cstr); explicit ArchSpec(llvm::StringRef triple_str); - ArchSpec(const char *triple_cstr, Platform *platform); - ArchSpec(llvm::StringRef triple_str, Platform *platform); //------------------------------------------------------------------ /// Constructor over architecture name. /// @@ -301,6 +282,12 @@ public: //------------------------------------------------------------------ const ArchSpec &operator=(const ArchSpec &rhs); + //--------------------------------------------------------------------------- + /// Returns true if the OS, vendor and environment fields of the triple are + /// unset. The triple is expected to be normalized (llvm::Triple::normalize). + //--------------------------------------------------------------------------- + static bool ContainsOnlyArch(const llvm::Triple &normalized_triple); + static size_t AutoComplete(llvm::StringRef name, StringList &matches); //------------------------------------------------------------------ @@ -533,10 +520,6 @@ public: bool SetTriple(const llvm::Triple &triple); bool SetTriple(llvm::StringRef triple_str); - bool SetTriple(llvm::StringRef triple_str, Platform *platform); - - bool SetTriple(const char *triple_cstr); - bool SetTriple(const char *triple_cstr, Platform *platform); //------------------------------------------------------------------ /// Returns the default endianness of the architecture. @@ -573,34 +556,12 @@ public: //------------------------------------------------------------------ bool IsCompatibleMatch(const ArchSpec &rhs) const; - //------------------------------------------------------------------ - /// Get a stop info override callback for the current architecture. - /// - /// Most platform specific code should go in lldb_private::Platform, - /// but there are cases where no matter which platform you are on - /// certain things hold true. - /// - /// This callback is currently intended to handle cases where a - /// program stops at an instruction that won't get executed and it - /// allows the stop reasonm, like "breakpoint hit", to be replaced - /// with a different stop reason like "no stop reason". - /// - /// This is specifically used for ARM in Thumb code when we stop in - /// an IT instruction (if/then/else) where the instruction won't get - /// executed and therefore it wouldn't be correct to show the program - /// stopped at the current PC. The code is generic and applies to all - /// ARM CPUs. - /// - /// @return NULL or a valid stop info override callback for the - /// current architecture. - //------------------------------------------------------------------ - StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const; - bool IsFullySpecifiedTriple() const; void PiecewiseTripleCompare(const ArchSpec &other, bool &arch_different, bool &vendor_different, bool &os_different, - bool &os_version_different, bool &env_different); + bool &os_version_different, + bool &env_different) const; //------------------------------------------------------------------ /// Detect whether this architecture uses thumb code exclusively @@ -661,5 +622,4 @@ bool ParseMachCPUDashSubtypeTriple(llvm::StringRef triple_str, ArchSpec &arch); } // namespace lldb_private -#endif // #if defined(__cplusplus) -#endif // #ifndef liblldb_ArchSpec_h_ +#endif // #ifndef LLDB_UTILITY_ARCHSPEC_H diff --git a/include/lldb/Utility/DataExtractor.h b/include/lldb/Utility/DataExtractor.h index 4ef78c1af4923..8107a3554422b 100644 --- a/include/lldb/Utility/DataExtractor.h +++ b/include/lldb/Utility/DataExtractor.h @@ -513,10 +513,8 @@ public: /// /// Extract a single integer value and update the offset pointed to /// by \a offset_ptr. The size of the extracted integer is specified - /// by the \a byte_size argument. \a byte_size should have a value - /// >= 1 and <= 4 since the return value is only 32 bits wide. Any - /// \a byte_size values less than 1 or greater than 4 will result in - /// nothing being extracted, and zero being returned. + /// by the \a byte_size argument. \a byte_size must have a value + /// >= 1 and <= 4 since the return value is only 32 bits wide. /// /// @param[in,out] offset_ptr /// A pointer to an offset within the data that will be advanced @@ -539,11 +537,9 @@ public: /// /// Extract a single unsigned integer value and update the offset /// pointed to by \a offset_ptr. The size of the extracted integer - /// is specified by the \a byte_size argument. \a byte_size should + /// is specified by the \a byte_size argument. \a byte_size must /// have a value greater than or equal to one and less than or equal - /// to eight since the return value is 64 bits wide. Any - /// \a byte_size values less than 1 or greater than 8 will result in - /// nothing being extracted, and zero being returned. + /// to eight since the return value is 64 bits wide. /// /// @param[in,out] offset_ptr /// A pointer to an offset within the data that will be advanced @@ -570,10 +566,9 @@ public: /// Extract a single signed integer value (sign extending if required) /// and update the offset pointed to by \a offset_ptr. The size of /// the extracted integer is specified by the \a byte_size argument. - /// \a byte_size should have a value greater than or equal to one - /// and less than or equal to eight since the return value is 64 - /// bits wide. Any \a byte_size values less than 1 or greater than - /// 8 will result in nothing being extracted, and zero being returned. + /// \a byte_size must have a value greater than or equal to one and + /// less than or equal to eight since the return value is 64 bits + /// wide. /// /// @param[in,out] offset_ptr /// A pointer to an offset within the data that will be advanced @@ -589,7 +584,7 @@ public: /// The sign extended signed integer value that was extracted, /// or zero on failure. //------------------------------------------------------------------ - int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t size) const; + int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t byte_size) const; //------------------------------------------------------------------ /// Extract an unsigned integer of size \a byte_size from \a @@ -598,11 +593,9 @@ public: /// /// Extract a single unsigned integer value and update the offset /// pointed to by \a offset_ptr. The size of the extracted integer - /// is specified by the \a byte_size argument. \a byte_size should + /// is specified by the \a byte_size argument. \a byte_size must /// have a value greater than or equal to one and less than or equal - /// to 8 since the return value is 64 bits wide. Any - /// \a byte_size values less than 1 or greater than 8 will result in - /// nothing being extracted, and zero being returned. + /// to 8 since the return value is 64 bits wide. /// /// @param[in,out] offset_ptr /// A pointer to an offset within the data that will be advanced @@ -641,10 +634,9 @@ public: /// Extract a single signed integer value (sign extending if required) /// and update the offset pointed to by \a offset_ptr. The size of /// the extracted integer is specified by the \a byte_size argument. - /// \a byte_size should have a value greater than or equal to one - /// and less than or equal to eight since the return value is 64 - /// bits wide. Any \a byte_size values less than 1 or greater than - /// 8 will result in nothing being extracted, and zero being returned. + /// \a byte_size must have a value greater than or equal to one and + /// less than or equal to eight since the return value is 64 bits + /// wide. /// /// @param[in,out] offset_ptr /// A pointer to an offset within the data that will be advanced diff --git a/include/lldb/Utility/FileSpec.h b/include/lldb/Utility/FileSpec.h index 67926d01e5296..55d44d84087d5 100644 --- a/include/lldb/Utility/FileSpec.h +++ b/include/lldb/Utility/FileSpec.h @@ -61,7 +61,7 @@ namespace lldb_private { //---------------------------------------------------------------------- class FileSpec { public: - enum PathSyntax { + enum PathSyntax : unsigned char { ePathSyntaxPosix, ePathSyntaxWindows, ePathSyntaxHostNative diff --git a/include/lldb/Utility/Log.h b/include/lldb/Utility/Log.h index d856fc81eb0d1..80a80fc164853 100644 --- a/include/lldb/Utility/Log.h +++ b/include/lldb/Utility/Log.h @@ -96,6 +96,9 @@ public: } }; + + static void Initialize(); + //------------------------------------------------------------------ // Static accessors for logging channels //------------------------------------------------------------------ @@ -193,6 +196,8 @@ private: static uint32_t GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry, llvm::ArrayRef<const char *> categories); + static void DisableLoggingChild(); + Log(const Log &) = delete; void operator=(const Log &) = delete; }; diff --git a/include/lldb/Utility/Logging.h b/include/lldb/Utility/Logging.h index 865097e7c1944..2c75a3bf218b5 100644 --- a/include/lldb/Utility/Logging.h +++ b/include/lldb/Utility/Logging.h @@ -62,7 +62,7 @@ Log *GetLogIfAllCategoriesSet(uint32_t mask); Log *GetLogIfAnyCategoriesSet(uint32_t mask); -void InitializeLog(); +void InitializeLldbChannel(); } // namespace lldb_private diff --git a/include/lldb/Utility/SharingPtr.h b/include/lldb/Utility/SharingPtr.h index 49b0020da3ef4..41fa0c8121d89 100644 --- a/include/lldb/Utility/SharingPtr.h +++ b/include/lldb/Utility/SharingPtr.h @@ -529,16 +529,7 @@ public: ~IntrusiveSharingPtr() { release_shared(); -#if defined(LLDB_CONFIGURATION_DEBUG) || defined(LLDB_CONFIGURATION_RELEASE) - // NULL out the pointer in objects which can help with leaks detection. - // We don't enable this for LLDB_CONFIGURATION_BUILD_AND_INTEGRATION or - // when none of the LLDB_CONFIGURATION_XXX macros are defined since - // those would be builds for release. But for debug and release builds - // that are for development, we NULL out the pointers to catch potential - // issues. ptr_ = nullptr; -#endif // #if defined (LLDB_CONFIGURATION_DEBUG) || defined - // (LLDB_CONFIGURATION_RELEASE) } T &operator*() const { return *ptr_; } diff --git a/include/lldb/Utility/Status.h b/include/lldb/Utility/Status.h index d520ebd942ee4..8c3e009a8c2e5 100644 --- a/include/lldb/Utility/Status.h +++ b/include/lldb/Utility/Status.h @@ -88,19 +88,6 @@ public: //------------------------------------------------------------------ const Status &operator=(const Status &rhs); - //------------------------------------------------------------------ - /// Assignment operator from a kern_return_t. - /// - /// Sets the type to \c MachKernel and the error code to \a err. - /// - /// @param[in] err - /// A mach error code. - /// - /// @return - /// A const reference to this object. - //------------------------------------------------------------------ - const Status &operator=(uint32_t err); - ~Status(); // llvm::Error support diff --git a/include/lldb/Utility/StringList.h b/include/lldb/Utility/StringList.h index 2be9a6bd8346b..6553e5dfdfb97 100644 --- a/include/lldb/Utility/StringList.h +++ b/include/lldb/Utility/StringList.h @@ -29,7 +29,7 @@ class StringList { public: StringList(); - StringList(const char *str); + explicit StringList(const char *str); StringList(const char **strv, int strc); diff --git a/include/lldb/Utility/UUID.h b/include/lldb/Utility/UUID.h index 6313025dec15e..5e64e90797893 100644 --- a/include/lldb/Utility/UUID.h +++ b/include/lldb/Utility/UUID.h @@ -46,7 +46,7 @@ public: const void *GetBytes() const; - size_t GetByteSize(); + size_t GetByteSize() const; bool IsValid() const; diff --git a/include/lldb/lldb-enumerations.h b/include/lldb/lldb-enumerations.h index 14bae6ca206d7..760e12b0e799d 100644 --- a/include/lldb/lldb-enumerations.h +++ b/include/lldb/lldb-enumerations.h @@ -380,7 +380,8 @@ FLAGS_ENUM(BreakpointEventType){ eBreakpointEventTypeCommandChanged = (1u << 8), eBreakpointEventTypeConditionChanged = (1u << 9), eBreakpointEventTypeIgnoreChanged = (1u << 10), - eBreakpointEventTypeThreadChanged = (1u << 11)}; + eBreakpointEventTypeThreadChanged = (1u << 11), + eBreakpointEventTypeAutoContinueChanged = (1u << 12)}; FLAGS_ENUM(WatchpointEventType){ eWatchpointEventTypeInvalidType = (1u << 0), @@ -566,6 +567,7 @@ enum CommandArgumentType { eArgTypeWatchpointIDRange, eArgTypeWatchType, eArgRawInput, + eArgTypeCommand, eArgTypeLastArg // Always keep this entry as the last entry in this // enumeration!! }; @@ -626,6 +628,7 @@ enum SectionType { eSectionTypeDWARFDebugAbbrev, eSectionTypeDWARFDebugAddr, eSectionTypeDWARFDebugAranges, + eSectionTypeDWARFDebugCuIndex, eSectionTypeDWARFDebugFrame, eSectionTypeDWARFDebugInfo, eSectionTypeDWARFDebugLine, @@ -764,8 +767,8 @@ enum TemplateArgumentKind { eTemplateArgumentKindTemplate, eTemplateArgumentKindTemplateExpansion, eTemplateArgumentKindExpression, - eTemplateArgumentKindPack - + eTemplateArgumentKindPack, + eTemplateArgumentKindNullPtr, }; //---------------------------------------------------------------------- @@ -931,8 +934,8 @@ enum ExpressionEvaluationPhase { // Indicates what types of events cause the watchpoint to fire. // Used by Native*Protocol-related classes. //---------------------------------------------------------------------- -FLAGS_ENUM(WatchpointKind){eWatchpointKindRead = (1u << 0), - eWatchpointKindWrite = (1u << 1)}; +FLAGS_ENUM(WatchpointKind){eWatchpointKindWrite = (1u << 0), + eWatchpointKindRead = (1u << 1)}; enum GdbSignal { eGdbSignalBadAccess = 0x91, diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h index 392dc641558de..a324edf9da3bc 100644 --- a/include/lldb/lldb-forward.h +++ b/include/lldb/lldb-forward.h @@ -38,6 +38,8 @@ class BreakpointList; class BreakpointLocation; class BreakpointLocationCollection; class BreakpointLocationList; +class BreakpointName; +class BreakpointOptionGroup; class BreakpointOptions; class BreakpointResolver; class BreakpointSite; diff --git a/include/lldb/lldb-private-defines.h b/include/lldb/lldb-private-defines.h index 53c5f31bab8cd..22172366c259b 100644 --- a/include/lldb/lldb-private-defines.h +++ b/include/lldb/lldb-private-defines.h @@ -13,8 +13,7 @@ #if defined(__cplusplus) // Include Compiler.h here so we don't define LLVM_FALLTHROUGH and then -// Compiler.h -// later tries to redefine it. +// Compiler.h later tries to redefine it. #include "llvm/Support/Compiler.h" #ifndef LLVM_FALLTHROUGH diff --git a/include/lldb/lldb-private-forward.h b/include/lldb/lldb-private-forward.h index 296facb1a0bdc..ea122525ef906 100644 --- a/include/lldb/lldb-private-forward.h +++ b/include/lldb/lldb-private-forward.h @@ -30,10 +30,6 @@ class UnixSignals; // SP/WP decls. // --------------------------------------------------------------- typedef std::shared_ptr<NativeBreakpoint> NativeBreakpointSP; -typedef std::shared_ptr<lldb_private::NativeRegisterContext> - NativeRegisterContextSP; -typedef std::shared_ptr<lldb_private::NativeThreadProtocol> - NativeThreadProtocolSP; } #endif // #if defined(__cplusplus) |