diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/include')
326 files changed, 4587 insertions, 3371 deletions
diff --git a/contrib/llvm/tools/lldb/include/lldb/API/LLDB.h b/contrib/llvm/tools/lldb/include/lldb/API/LLDB.h index d8604cd..cf61b10 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/LLDB.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/LLDB.h @@ -63,6 +63,8 @@ #include "lldb/API/SBThread.h" #include "lldb/API/SBThreadCollection.h" #include "lldb/API/SBThreadPlan.h" +#include "lldb/API/SBTrace.h" +#include "lldb/API/SBTraceOptions.h" #include "lldb/API/SBType.h" #include "lldb/API/SBTypeCategory.h" #include "lldb/API/SBTypeEnumMember.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBAddress.h b/contrib/llvm/tools/lldb/include/lldb/API/SBAddress.h index ddbe5a7..9e697be 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBAddress.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBAddress.h @@ -103,6 +103,8 @@ protected: const lldb_private::Address *operator->() const; + friend bool operator==(const SBAddress &lhs, const SBAddress &rhs); + lldb_private::Address *get(); lldb_private::Address &ref(); @@ -117,6 +119,8 @@ private: std::unique_ptr<lldb_private::Address> m_opaque_ap; }; +bool operator==(const SBAddress &lhs, const SBAddress &rhs); + } // namespace lldb #endif // LLDB_SBAddress_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBAttachInfo.h b/contrib/llvm/tools/lldb/include/lldb/API/SBAttachInfo.h index 6c35616..7ae0069 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBAttachInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBAttachInfo.h @@ -86,7 +86,7 @@ public: /// This function implies that a call to SBTarget::Attach(...) will /// be synchronous. /// - /// @param[in] wait_for + /// @param[in] b /// If \b false, attach to an existing process whose name matches. /// If \b true, then wait for the next process whose name matches. //------------------------------------------------------------------ @@ -99,7 +99,7 @@ public: /// Future calls to SBTarget::Attach(...) will be synchronous or /// asynchronous depending on the \a async argument. /// - /// @param[in] wait_for + /// @param[in] b /// If \b false, attach to an existing process whose name matches. /// If \b true, then wait for the next process whose name matches. /// @@ -162,7 +162,7 @@ public: /// Get the listener that will be used to receive process events. /// /// If no listener has been set via a call to - /// SBLaunchInfo::SetListener(), then an invalid SBListener will be + /// SBAttachInfo::SetListener(), then an invalid SBListener will be /// returned (SBListener::IsValid() will return false). If a listener /// has been set, then the valid listener object will be returned. //---------------------------------------------------------------------- diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpoint.h b/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpoint.h index 56509c9..9abc9cd 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpoint.h @@ -133,19 +133,13 @@ private: SBBreakpoint(const lldb::BreakpointSP &bp_sp); - lldb_private::Breakpoint *operator->() const; - - lldb_private::Breakpoint *get() const; - - lldb::BreakpointSP &operator*(); - - const lldb::BreakpointSP &operator*() const; - static bool PrivateBreakpointHitCallback( void *baton, lldb_private::StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id); - lldb::BreakpointSP m_opaque_sp; + lldb::BreakpointSP GetSP() const; + + lldb::BreakpointWP m_opaque_wp; }; class LLDB_API SBBreakpointList { @@ -160,9 +154,9 @@ public: SBBreakpoint FindBreakpointByID(lldb::break_id_t); - void Append(const SBBreakpoint &sb_file); + void Append(const SBBreakpoint &sb_bkpt); - bool AppendIfUnique(const SBBreakpoint &sb_file); + bool AppendIfUnique(const SBBreakpoint &sb_bkpt); void AppendByID(lldb::break_id_t id); diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpointLocation.h b/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpointLocation.h index 344c39c..0b5ba79 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpointLocation.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpointLocation.h @@ -78,8 +78,9 @@ private: friend class SBBreakpoint; void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp); + BreakpointLocationSP GetSP() const; - lldb::BreakpointLocationSP m_opaque_sp; + lldb::BreakpointLocationWP m_opaque_wp; }; } // namespace lldb diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBDefines.h b/contrib/llvm/tools/lldb/include/lldb/API/SBDefines.h index 25443c4..d70e912 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBDefines.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBDefines.h @@ -79,6 +79,8 @@ class LLDB_API SBTarget; class LLDB_API SBThread; class LLDB_API SBThreadCollection; class LLDB_API SBThreadPlan; +class LLDB_API SBTrace; +class LLDB_API SBTraceOptions; class LLDB_API SBType; class LLDB_API SBTypeCategory; class LLDB_API SBTypeEnumMember; diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBError.h b/contrib/llvm/tools/lldb/include/lldb/API/SBError.h index 7f2f3a6..a099a9b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBError.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBError.h @@ -61,24 +61,25 @@ protected: friend class SBProcess; friend class SBStructuredData; friend class SBThread; + friend class SBTrace; friend class SBTarget; friend class SBValue; friend class SBWatchpoint; friend class SBBreakpoint; friend class SBBreakpointLocation; - lldb_private::Error *get(); + lldb_private::Status *get(); - lldb_private::Error *operator->(); + lldb_private::Status *operator->(); - const lldb_private::Error &operator*() const; + const lldb_private::Status &operator*() const; - lldb_private::Error &ref(); + lldb_private::Status &ref(); - void SetError(const lldb_private::Error &lldb_error); + void SetError(const lldb_private::Status &lldb_error); private: - std::unique_ptr<lldb_private::Error> m_opaque_ap; + std::unique_ptr<lldb_private::Status> m_opaque_ap; void CreateIfNeeded(); }; diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBFrame.h b/contrib/llvm/tools/lldb/include/lldb/API/SBFrame.h index be5c092..5833975 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBFrame.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBFrame.h @@ -78,6 +78,10 @@ public: const char *GetDisplayFunctionName(); const char *GetFunctionName() const; + + // Return the frame function's language. If there isn't a function, then + // guess the language type from the mangled name. + lldb::LanguageType GuessLanguage() const; /// Return true if this frame represents an inlined function. /// diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBInstruction.h b/contrib/llvm/tools/lldb/include/lldb/API/SBInstruction.h index 0fc12eb..23daf1c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBInstruction.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBInstruction.h @@ -53,6 +53,8 @@ public: bool HasDelaySlot(); + bool CanSetBreakpoint(); + void Print(FILE *out); bool GetDescription(lldb::SBStream &description); diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBInstructionList.h b/contrib/llvm/tools/lldb/include/lldb/API/SBInstructionList.h index 29baef57..0323a3c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBInstructionList.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBInstructionList.h @@ -32,6 +32,15 @@ public: lldb::SBInstruction GetInstructionAtIndex(uint32_t idx); + // ---------------------------------------------------------------------- + // Returns the number of instructions between the start and end address. + // If canSetBreakpoint is true then the count will be the number of + // instructions on which a breakpoint can be set. + // ---------------------------------------------------------------------- + size_t GetInstructionsCount(const SBAddress &start, + const SBAddress &end, + bool canSetBreakpoint = false); + void Clear(); void AppendInstruction(lldb::SBInstruction inst); diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBListener.h b/contrib/llvm/tools/lldb/include/lldb/API/SBListener.h index 05282c2..a2f82a8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBListener.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBListener.h @@ -89,7 +89,7 @@ protected: SBListener(const lldb::ListenerSP &listener_sp); - lldb::ListenerSP GetSP() { return m_opaque_sp; } + lldb::ListenerSP GetSP(); private: lldb_private::Listener *operator->() const; diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBPlatform.h b/contrib/llvm/tools/lldb/include/lldb/API/SBPlatform.h index 3f7e1ac..952e310 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBPlatform.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBPlatform.h @@ -156,7 +156,8 @@ protected: void SetSP(const lldb::PlatformSP &platform_sp); SBError ExecuteConnected( - const std::function<lldb_private::Error(const lldb::PlatformSP &)> &func); + const std::function<lldb_private::Status(const lldb::PlatformSP &)> + &func); lldb::PlatformSP m_opaque_sp; }; diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBProcess.h b/contrib/llvm/tools/lldb/include/lldb/API/SBProcess.h index fd95790..d57d5ce 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBProcess.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBProcess.h @@ -234,6 +234,33 @@ public: bool GetDescription(lldb::SBStream &description); + //------------------------------------------------------------------ + /// Start Tracing with the given SBTraceOptions. + /// + /// @param[in] options + /// Class containing trace options like trace buffer size, meta + /// data buffer size, TraceType and any custom parameters + /// {formatted as a JSON Dictionary}. In case of errors in + /// formatting, an error would be reported. + /// It must be noted that tracing options such as buffer sizes + /// or other custom parameters passed maybe invalid for some + /// trace technologies. In such cases the trace implementations + /// could choose to either throw an error or could round off to + /// the nearest valid options to start tracing if the passed + /// value is not supported. To obtain the actual used trace + /// options please use the GetTraceConfig API. For the custom + /// parameters, only the parameters recognized by the target + /// would be used and others would be ignored. + /// + /// @param[out] error + /// An error explaining what went wrong. + /// + /// @return + /// A SBTrace instance, which should be used + /// to get the trace data or other trace related operations. + //------------------------------------------------------------------ + lldb::SBTrace StartTrace(SBTraceOptions &options, lldb::SBError &error); + uint32_t GetNumSupportedHardwareWatchpoints(lldb::SBError &error) const; //------------------------------------------------------------------ @@ -323,7 +350,7 @@ public: bool IsInstrumentationRuntimePresent(InstrumentationRuntimeType type); - // Save the state of the process in a core file (or mini dump on Windows). + /// Save the state of the process in a core file (or mini dump on Windows). lldb::SBError SaveCore(const char *file_name); //------------------------------------------------------------------ diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBStructuredData.h b/contrib/llvm/tools/lldb/include/lldb/API/SBStructuredData.h index 9f0203b..f7a6469 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBStructuredData.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBStructuredData.h @@ -13,8 +13,6 @@ #include "lldb/API/SBDefines.h" #include "lldb/API/SBModule.h" -class StructuredDataImpl; - namespace lldb { class SBStructuredData { @@ -31,15 +29,78 @@ public: bool IsValid() const; + lldb::SBError SetFromJSON(lldb::SBStream &stream); + void Clear(); lldb::SBError GetAsJSON(lldb::SBStream &stream) const; lldb::SBError GetDescription(lldb::SBStream &stream) const; -private: - std::unique_ptr<StructuredDataImpl> m_impl_up; + //------------------------------------------------------------------ + /// Return the type of data in this data structure + //------------------------------------------------------------------ + lldb::StructuredDataType GetType() const; + + //------------------------------------------------------------------ + /// Return the size (i.e. number of elements) in this data structure + /// if it is an array or dictionary type. For other types, 0 will be + // returned. + //------------------------------------------------------------------ + size_t GetSize() const; + + //------------------------------------------------------------------ + /// Return the value corresponding to a key if this data structure + /// is a dictionary type. + //------------------------------------------------------------------ + lldb::SBStructuredData GetValueForKey(const char *key) const; + + //------------------------------------------------------------------ + /// Return the value corresponding to an index if this data structure + /// is array. + //------------------------------------------------------------------ + lldb::SBStructuredData GetItemAtIndex(size_t idx) const; + + //------------------------------------------------------------------ + /// Return the integer value if this data structure is an integer type. + //------------------------------------------------------------------ + uint64_t GetIntegerValue(uint64_t fail_value = 0) const; + + //------------------------------------------------------------------ + /// Return the floating point value if this data structure is a floating + /// type. + //------------------------------------------------------------------ + double GetFloatValue(double fail_value = 0.0) const; + + //------------------------------------------------------------------ + /// Return the boolean value if this data structure is a boolean type. + //------------------------------------------------------------------ + bool GetBooleanValue(bool fail_value = false) const; + + //------------------------------------------------------------------ + /// Provides the string value if this data structure is a string type. + /// + /// @param[out] dst + /// pointer where the string value will be written. In case it is null, + /// nothing will be written at @dst. + /// + /// @param[in] dst_len + /// max number of characters that can be written at @dst. In case it is + /// zero, nothing will be written at @dst. If this length is not enough + /// to write the complete string value, (dst_len-1) bytes of the string + /// value will be written at @dst followed by a null character. + /// + /// @return + /// Returns the byte size needed to completely write the string value at + /// @dst in all cases. + //------------------------------------------------------------------ + size_t GetStringValue(char *dst, size_t dst_len) const; + +protected: + friend class SBTraceOptions; + + StructuredDataImplUP m_impl_up; }; -} +} // namespace lldb #endif /* SBStructuredData_h */ diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBTarget.h b/contrib/llvm/tools/lldb/include/lldb/API/SBTarget.h index 4e8db83..62398fc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBTarget.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBTarget.h @@ -124,9 +124,6 @@ public: /// @param[in] envp /// The environment array. /// - /// @param[in] launch_flags - /// Flags to modify the launch (@see lldb::LaunchFlags) - /// /// @param[in] stdin_path /// The path to use when re-directing the STDIN of the new /// process. If all stdXX_path arguments are nullptr, a pseudo @@ -480,6 +477,7 @@ public: /// Resolve a current file address into a section offset address. /// /// @param[in] file_addr + /// The file address to resolve. /// /// @return /// An SBAddress which will be valid if... @@ -546,7 +544,7 @@ public: /// into this call /// /// @param[out] error - /// Error information is written here if the memory read fails. + /// Status information is written here if the memory read fails. /// /// @return /// The amount of data read in host bytes. @@ -653,7 +651,7 @@ public: /// @param[in] source_file /// The file from which to read the breakpoints. /// - /// @param[out] bkpt_list + /// @param[out] new_bps /// A list of the newly created breakpoints. /// /// @return @@ -673,7 +671,7 @@ public: /// Only read in breakpoints whose names match one of the names in this /// list. /// - /// @param[out] bkpt_list + /// @param[out] new_bps /// A list of the newly created breakpoints. /// /// @return diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBTrace.h b/contrib/llvm/tools/lldb/include/lldb/API/SBTrace.h new file mode 100644 index 0000000..244a01e --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBTrace.h @@ -0,0 +1,123 @@ +//===-- SBTrace.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_SBTrace_h_ +#define LLDB_SBTrace_h_ + +#include "lldb/API/SBDefines.h" +#include "lldb/API/SBError.h" + +class TraceImpl; + +namespace lldb { + +class LLDB_API SBTrace { +public: + SBTrace(); + //------------------------------------------------------------------ + /// Obtain the trace data as raw bytes. + /// + /// @param[out] error + /// An error explaining what went wrong. + /// + /// @param[in] buf + /// Buffer to write the trace data to. + /// + /// @param[in] size + /// The size of the buffer used to read the data. This is + /// also the size of the data intended to read. It is also + /// possible to partially read the trace data for some trace + /// technologies by specifying a smaller buffer. + /// + /// @param[in] offset + /// The start offset to begin reading the trace data. + /// + /// @param[in] thread_id + /// Tracing could be started for the complete process or a + /// single thread, in the first case the traceid obtained would + /// map to all the threads existing within the process and the + /// ones spawning later. The thread_id parameter can be used in + /// such a scenario to select the trace data for a specific + /// thread. + /// + /// @return + /// The size of the trace data effectively read by the API call. + //------------------------------------------------------------------ + size_t GetTraceData(SBError &error, void *buf, size_t size, size_t offset = 0, + lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); + + //------------------------------------------------------------------ + /// Obtain any meta data as raw bytes for the tracing instance. + /// The input parameter definition is similar to the previous + /// function. + //------------------------------------------------------------------ + size_t GetMetaData(SBError &error, void *buf, size_t size, size_t offset = 0, + lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); + + //------------------------------------------------------------------ + /// Stop the tracing instance. Stopping the trace will also + /// lead to deletion of any gathered trace data. + /// + /// @param[out] error + /// An error explaining what went wrong. + /// + /// @param[in] thread_id + /// The trace id could map to a tracing instance for a thread + /// or could also map to a group of threads being traced with + /// the same trace options. A thread_id is normally optional + /// except in the case of tracing a complete process and tracing + /// needs to switched off on a particular thread. + /// A situation could occur where initially a thread (lets say + /// thread A) is being individually traced with a particular + /// trace id and then tracing is started on the complete + /// process, in this case thread A will continue without any + /// change. All newly spawned threads would be traced with the + /// trace id of the process. + /// Now if the StopTrace API is called for the whole process, + /// thread A will not be stopped and must be stopped separately. + //------------------------------------------------------------------ + void StopTrace(SBError &error, + lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); + + //------------------------------------------------------------------ + /// Get the trace configuration being used for the trace instance. + /// The threadid in the SBTraceOptions needs to be set when the + /// configuration used by a specific thread is being requested. + /// + /// @param[out] options + /// The trace options actually used by the trace instance + /// would be filled by the API. + /// + /// @param[out] error + /// An error explaining what went wrong. + //------------------------------------------------------------------ + void GetTraceConfig(SBTraceOptions &options, SBError &error); + + lldb::user_id_t GetTraceUID(); + + bool IsValid(); + +protected: + typedef std::shared_ptr<TraceImpl> TraceImplSP; + + friend class SBProcess; + + void SetTraceUID(lldb::user_id_t uid); + + TraceImplSP m_trace_impl_sp; + + lldb::ProcessSP GetSP() const; + + void SetSP(const ProcessSP &process_sp); + + lldb::ProcessWP m_opaque_wp; +}; +} // namespace lldb + +#endif // LLDB_SBTrace_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBTraceOptions.h b/contrib/llvm/tools/lldb/include/lldb/API/SBTraceOptions.h new file mode 100644 index 0000000..c9735e1 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBTraceOptions.h @@ -0,0 +1,58 @@ +//===-- SBTraceOptions ------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef SBTRACEOPTIONS_H_ +#define SBTRACEOPTIONS_H_ + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +class LLDB_API SBTraceOptions { +public: + SBTraceOptions(); + + lldb::TraceType getType() const; + + uint64_t getTraceBufferSize() const; + + /// The trace parameters consist of any custom parameters + /// apart from the generic parameters such as + /// TraceType, trace_buffer_size and meta_data_buffer_size. + /// The returned parameters would be formatted as a JSON Dictionary. + lldb::SBStructuredData getTraceParams(lldb::SBError &error); + + uint64_t getMetaDataBufferSize() const; + + /// SBStructuredData is meant to hold any custom parameters + /// apart from meta buffer size and trace size. They should + /// be formatted as a JSON Dictionary. + void setTraceParams(lldb::SBStructuredData ¶ms); + + void setType(lldb::TraceType type); + + void setTraceBufferSize(uint64_t size); + + void setMetaDataBufferSize(uint64_t size); + + void setThreadID(lldb::tid_t thread_id); + + lldb::tid_t getThreadID(); + + bool IsValid(); + +protected: + friend class SBProcess; + friend class SBTrace; + + lldb::TraceOptionsSP m_traceoptions_sp; +}; +} + +#endif /* SBTRACEOPTIONS_H_ */ diff --git a/contrib/llvm/tools/lldb/include/lldb/API/SBWatchpoint.h b/contrib/llvm/tools/lldb/include/lldb/API/SBWatchpoint.h index 284ec12..92d4851 100644 --- a/contrib/llvm/tools/lldb/include/lldb/API/SBWatchpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/API/SBWatchpoint.h @@ -72,7 +72,7 @@ private: friend class SBTarget; friend class SBValue; - lldb::WatchpointSP m_opaque_sp; + std::weak_ptr<lldb_private::Watchpoint> m_opaque_wp; }; } // namespace lldb diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Breakpoint.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Breakpoint.h index 9af6e58..4124133 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -26,8 +26,8 @@ #include "lldb/Breakpoint/Stoppoint.h" #include "lldb/Core/Event.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Core/StringList.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StringList.h" +#include "lldb/Utility/StructuredData.h" namespace lldb_private { @@ -169,7 +169,7 @@ public: virtual bool EvaluatePrecondition(StoppointCallbackContext &context); - virtual Error ConfigurePrecondition(Args &options); + virtual Status ConfigurePrecondition(Args &options); virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level); }; @@ -178,7 +178,7 @@ public: // Saving & restoring breakpoints: static lldb::BreakpointSP CreateFromStructuredData( - Target &target, StructuredData::ObjectSP &data_object_sp, Error &error); + Target &target, StructuredData::ObjectSP &data_object_sp, Status &error); static bool SerializedBreakpointMatchesNames(StructuredData::ObjectSP &bkpt_object_sp, @@ -613,7 +613,7 @@ public: lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; } - bool AddName(const char *new_name, Error &error); + bool AddName(llvm::StringRef new_name, Status &error); void RemoveName(const char *name_to_remove) { if (name_to_remove) diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointID.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointID.h index aa4add4..57411b3 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointID.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointID.h @@ -84,7 +84,7 @@ public: /// \b true if the name is a breakpoint name (as opposed to an ID or /// range) false otherwise. //------------------------------------------------------------------ - static bool StringIsBreakpointName(llvm::StringRef str, Error &error); + static bool StringIsBreakpointName(llvm::StringRef str, Status &error); //------------------------------------------------------------------ /// Takes a breakpoint ID and the breakpoint location id and returns diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointLocation.h index 43aef9f..a1086aa 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -19,7 +19,7 @@ // Project includes #include "lldb/Breakpoint/StoppointLocation.h" #include "lldb/Core/Address.h" -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -161,7 +161,7 @@ public: //------------------------------------------------------------------ const char *GetConditionText(size_t *hash = nullptr) const; - bool ConditionSaysStop(ExecutionContext &exe_ctx, Error &error); + bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error); //------------------------------------------------------------------ /// Set the valid thread to be checked when the breakpoint is hit. diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointOptions.h index e053af3..420d591 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -17,9 +17,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Baton.h" -#include "lldb/Core/StringList.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/Baton.h" +#include "lldb/Utility/StringList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -50,7 +50,7 @@ public: static std::unique_ptr<CommandData> CreateFromStructuredData(const StructuredData::Dictionary &options_dict, - Error &error); + Status &error); StringList user_source; std::string script_source; @@ -119,7 +119,7 @@ public: static std::unique_ptr<BreakpointOptions> CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); virtual StructuredData::ObjectSP SerializeToStructuredData(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolver.h index e19a213..7bcd889 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolver.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolver.h @@ -15,12 +15,11 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/Breakpoint.h" -#include "lldb/Breakpoint/BreakpointResolver.h" #include "lldb/Core/Address.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -141,7 +140,7 @@ public: static lldb::BreakpointResolverSP CreateFromStructuredData(const StructuredData::Dictionary &resolver_dict, - Error &error); + Status &error); virtual StructuredData::ObjectSP SerializeToStructuredData() { return StructuredData::ObjectSP(); @@ -193,7 +192,7 @@ public: static const char *ResolverTyToName(enum ResolverTy); - static ResolverTy NameToResolverTy(const char *name); + static ResolverTy NameToResolverTy(llvm::StringRef name); virtual lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) = 0; diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h index 6d2d505..9d757c8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverAddress.h @@ -39,7 +39,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h index f1fdf60..f7bba3d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -36,7 +36,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -63,6 +63,8 @@ public: lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override; protected: + void FilterContexts(SymbolContextList &sc_list); + friend class Breakpoint; FileSpec m_file_spec; // This is the file spec we are looking for. uint32_t m_line_number; // This is the line number that we are looking for. diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index 0429e26..d620e99 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointResolver.h" -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { @@ -38,7 +38,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &options_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverName.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverName.h index 4223125..c7716d5 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverName.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointResolverName.h @@ -57,7 +57,7 @@ public: static BreakpointResolver * CreateFromStructuredData(Breakpoint *bkpt, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSite.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSite.h index b334c6e..6e98756 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSite.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/BreakpointSite.h @@ -21,7 +21,7 @@ // Project includes #include "lldb/Breakpoint/BreakpointLocationCollection.h" #include "lldb/Breakpoint/StoppointLocation.h" -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-forward.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Stoppoint.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Stoppoint.h index 5d131a5..3195ef9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Stoppoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Stoppoint.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/StoppointLocation.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/StoppointLocation.h index ba03b4e..f64035b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/StoppointLocation.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/StoppointLocation.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/UserID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" // #include "lldb/Breakpoint/BreakpointOptions.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Watchpoint.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Watchpoint.h index 97f2e28..69067a5 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Watchpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/Watchpoint.h @@ -19,9 +19,9 @@ // Project includes #include "lldb/Breakpoint/StoppointLocation.h" #include "lldb/Breakpoint/WatchpointOptions.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -100,7 +100,7 @@ public: void DumpSnapshots(Stream *s, const char *prefix = nullptr) const; void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const; Target &GetTarget() { return m_target; } - const Error &GetError() { return m_error; } + const Status &GetError() { return m_error; } //------------------------------------------------------------------ /// Returns the WatchpointOptions structure set for this watchpoint. @@ -213,8 +213,8 @@ private: lldb::ValueObjectSP m_old_value_sp; lldb::ValueObjectSP m_new_value_sp; CompilerType m_type; - Error m_error; // An error object describing errors associated with this - // watchpoint. + Status m_error; // An error object describing errors associated with this + // watchpoint. WatchpointOptions m_options; // Settable watchpoint options, which is a delegate to handle // the callback machinery. diff --git a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/WatchpointOptions.h b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/WatchpointOptions.h index bfb814e..6ab1264 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Breakpoint/WatchpointOptions.h +++ b/contrib/llvm/tools/lldb/include/lldb/Breakpoint/WatchpointOptions.h @@ -17,8 +17,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Baton.h" -#include "lldb/Core/StringList.h" +#include "lldb/Utility/Baton.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Address.h b/contrib/llvm/tools/lldb/include/lldb/Core/Address.h index 909a060..4c77458 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Address.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Address.h @@ -10,13 +10,44 @@ #ifndef liblldb_Address_h_ #define liblldb_Address_h_ -// C Includes -// C++ Includes +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-enumerations.h" // for AddressClass::eAddressClassInvalid +#include "lldb/lldb-forward.h" // for SectionWP, SectionSP, ModuleSP +#include "lldb/lldb-types.h" // for addr_t -// Other libraries and framework includes -// Project includes -#include "lldb/Symbol/SymbolContextScope.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, UINT32_MAX, int64_t + +namespace lldb_private { +class Block; +} +namespace lldb_private { +class CompileUnit; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Symbol; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +struct LineEntry; +} namespace lldb_private { @@ -391,6 +422,10 @@ public: /// a section + offset. The Target's SectionLoadList object /// is used to resolve the address. /// + /// @param[in] allow_section_end + /// If true, treat an address pointing to the end of the module as + /// belonging to that module. + /// /// @return /// Returns \b true if the load address was resolved to be /// section/offset, \b false otherwise. It is often ok for an @@ -398,11 +433,13 @@ public: /// happens for JIT'ed code, or any load addresses on the stack /// or heap. //------------------------------------------------------------------ - bool SetLoadAddress(lldb::addr_t load_addr, Target *target); + bool SetLoadAddress(lldb::addr_t load_addr, Target *target, + bool allow_section_end = false); bool SetOpcodeLoadAddress( lldb::addr_t load_addr, Target *target, - lldb::AddressClass addr_class = lldb::eAddressClassInvalid); + lldb::AddressClass addr_class = lldb::eAddressClassInvalid, + bool allow_section_end = false); bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/AddressRange.h b/contrib/llvm/tools/lldb/include/lldb/Core/AddressRange.h index fa9fefb..e787d1d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/AddressRange.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/AddressRange.h @@ -10,11 +10,21 @@ #ifndef liblldb_AddressRange_h_ #define liblldb_AddressRange_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/Address.h" +#include "lldb/lldb-forward.h" // for SectionSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t + +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Target; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolver.h b/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolver.h index 5fe2ec1..432268e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolver.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolver.h @@ -10,20 +10,20 @@ #ifndef liblldb_AddressResolver_h_ #define liblldb_AddressResolver_h_ -#include <vector> - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Address.h" #include "lldb/Core/AddressRange.h" -#include "lldb/Core/ConstString.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +#include <stddef.h> // for size_t +#include <vector> namespace lldb_private { +class ModuleList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { //---------------------------------------------------------------------- /// @class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverFileLine.h b/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverFileLine.h index 950750e..ec15cc7 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverFileLine.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverFileLine.h @@ -10,8 +10,22 @@ #ifndef liblldb_AddressResolverFileLine_h_ #define liblldb_AddressResolverFileLine_h_ -// Project includes #include "lldb/Core/AddressResolver.h" +#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::CallbackR... +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverName.h b/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverName.h index e93d16f..aadc054 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverName.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/AddressResolverName.h @@ -10,10 +10,21 @@ #ifndef liblldb_AddressResolverName_h_ #define liblldb_AddressResolverName_h_ -// Project includes - #include "lldb/Core/AddressResolver.h" -#include "lldb/Core/RegularExpression.h" +#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::Call... +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/RegularExpression.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ArchSpec.h b/contrib/llvm/tools/lldb/include/lldb/Core/ArchSpec.h index 7f663f7..75c7079 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ArchSpec.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ArchSpec.h @@ -12,13 +12,31 @@ #if defined(__cplusplus) -#include "lldb/Core/ConstString.h" -#include "lldb/lldb-forward.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-private-enumerations.h" +#include "llvm/ADT/StringRef.h" // for StringRef #include "llvm/ADT/Triple.h" +#include <string> // for string + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Platform; +} namespace lldb_private { +class Stream; +} +namespace lldb_private { +class StringList; +} +namespace lldb_private { +class Thread; +} -struct CoreDefinition; +namespace lldb_private { //---------------------------------------------------------------------- /// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h" @@ -307,7 +325,7 @@ public: /// @return A string representing target CPU for the current /// architecture. //------------------------------------------------------------------ - std::string GetClangTargetCPU(); + std::string GetClangTargetCPU() const; //------------------------------------------------------------------ /// Return a string representing target application ABI. @@ -607,6 +625,7 @@ public: protected: bool IsEqualTo(const ArchSpec &rhs, bool exact_match) const; + void UpdateCore(); llvm::Triple m_triple; Core m_core = kCore_invalid; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Broadcaster.h b/contrib/llvm/tools/lldb/include/lldb/Core/Broadcaster.h index c23f12c..825287d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Broadcaster.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Broadcaster.h @@ -10,21 +10,33 @@ #ifndef liblldb_Broadcaster_h_ #define liblldb_Broadcaster_h_ -// C Includes -// C++ Includes -#include <functional> -#include <list> +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for ListenerSP, EventSP, Broadcast... + +#include "llvm/ADT/SmallVector.h" + +#include <cstdint> // for uint32_t, UINT32_MAX #include <map> +#include <memory> // for shared_ptr, operator==, enable... #include <mutex> +#include <set> // for set #include <string> +#include <utility> // for pair #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/lldb-private.h" - -#include "llvm/ADT/SmallVector.h" +namespace lldb_private { +class Broadcaster; +} +namespace lldb_private { +class EventData; +} +namespace lldb_private { +class Listener; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { @@ -82,8 +94,8 @@ protected: public: // Listeners hold onto weak pointers to their broadcaster managers. So they - // must be - // made into shared pointers, which you do with MakeBroadcasterManager. + // must be made into shared pointers, which you do with + // MakeBroadcasterManager. static lldb::BroadcasterManagerSP MakeBroadcasterManager(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Communication.h b/contrib/llvm/tools/lldb/include/lldb/Core/Communication.h index 8a875dd..57fa483 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Communication.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Communication.h @@ -10,19 +10,31 @@ #ifndef liblldb_Communication_h_ #define liblldb_Communication_h_ -// C Includes -// C++ Includes +#include "lldb/Core/Broadcaster.h" +#include "lldb/Host/HostThread.h" +#include "lldb/Utility/Timeout.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ConnectionStatus, FLAGS_ANONYMOU... +#include "lldb/lldb-forward.h" // for ConnectionSP +#include "lldb/lldb-types.h" // for thread_arg_t, thread_result_t + #include <atomic> #include <mutex> +#include <ratio> // for micro #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Broadcaster.h" -#include "lldb/Core/Error.h" -#include "lldb/Host/HostThread.h" -#include "lldb/Utility/Timeout.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint8_t + +namespace lldb_private { +class Connection; +} +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class Status; +} namespace lldb_private { @@ -59,7 +71,7 @@ namespace lldb_private { /// reads data and caches any received bytes. To start the read thread /// clients call: /// -/// bool Communication::StartReadThread (Error *); +/// bool Communication::StartReadThread (Status *); /// /// If true is returned a read thread has been spawned that will /// continually execute a call to the pure virtual DoRead function: @@ -142,10 +154,10 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); /// @see bool Connection::Connect (const char *url); //------------------------------------------------------------------ - lldb::ConnectionStatus Connect(const char *url, Error *error_ptr); + lldb::ConnectionStatus Connect(const char *url, Status *error_ptr); //------------------------------------------------------------------ /// Disconnect the communications connection if one is currently @@ -156,10 +168,10 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); /// @see bool Connection::Disconnect (); //------------------------------------------------------------------ - lldb::ConnectionStatus Disconnect(Error *error_ptr = nullptr); + lldb::ConnectionStatus Disconnect(Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Check if the connection is valid. @@ -205,7 +217,7 @@ public: /// @see size_t Connection::Read (void *, size_t); //------------------------------------------------------------------ size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr); + lldb::ConnectionStatus &status, Status *error_ptr); //------------------------------------------------------------------ /// The actual write function that attempts to write to the @@ -225,7 +237,7 @@ public: /// The number of bytes actually Written. //------------------------------------------------------------------ size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, - Error *error_ptr); + Status *error_ptr); //------------------------------------------------------------------ /// Sets the connection that it to be used by this class. @@ -268,7 +280,7 @@ public: /// @see void Communication::AppendBytesToCache (const uint8_t * bytes, size_t /// len, bool broadcast); //------------------------------------------------------------------ - virtual bool StartReadThread(Error *error_ptr = nullptr); + virtual bool StartReadThread(Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Stops the read thread by cancelling it. @@ -277,9 +289,9 @@ public: /// \b True if the read thread was successfully canceled, \b /// false otherwise. //------------------------------------------------------------------ - virtual bool StopReadThread(Error *error_ptr = nullptr); + virtual bool StopReadThread(Status *error_ptr = nullptr); - virtual bool JoinReadThread(Error *error_ptr = nullptr); + virtual bool JoinReadThread(Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Checks if there is a currently running read thread. /// @@ -349,7 +361,7 @@ protected: size_t ReadFromConnection(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr); + lldb::ConnectionStatus &status, Status *error_ptr); //------------------------------------------------------------------ /// Append new bytes that get read from the read thread into the diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/DataBufferMemoryMap.h b/contrib/llvm/tools/lldb/include/lldb/Core/DataBufferMemoryMap.h deleted file mode 100644 index 1b8277b..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Core/DataBufferMemoryMap.h +++ /dev/null @@ -1,154 +0,0 @@ -//===-- DataBufferMemoryMap.h -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_DataBufferMemoryMap_h_ -#define liblldb_DataBufferMemoryMap_h_ - -#include "lldb/Core/DataBuffer.h" -#include "lldb/Core/Error.h" -#include "lldb/lldb-private.h" -#include <string> - -namespace lldb_private { - -//---------------------------------------------------------------------- -/// @class DataBufferMemoryMap DataBufferMemoryMap.h -/// "lldb/Core/DataBufferMemoryMap.h" -/// @brief A subclass of DataBuffer that memory maps data. -/// -/// This class memory maps data and stores any needed data for the -/// memory mapping in its internal state. Memory map requests are not -/// required to have any alignment or size constraints, this class will -/// work around any host OS issues regarding such things. -/// -/// This class is designed to allow pages to be faulted in as needed and -/// works well data from large files that won't be accessed all at once. -//---------------------------------------------------------------------- -class DataBufferMemoryMap : public DataBuffer { -public: - //------------------------------------------------------------------ - /// Default Constructor - //------------------------------------------------------------------ - DataBufferMemoryMap(); - - //------------------------------------------------------------------ - /// Destructor. - /// - /// Virtual destructor since this class inherits from a pure virtual - /// base class #DataBuffer. - //------------------------------------------------------------------ - ~DataBufferMemoryMap() override; - - //------------------------------------------------------------------ - /// Reverts this object to an empty state by unmapping any memory - /// that is currently owned. - //------------------------------------------------------------------ - void Clear(); - - //------------------------------------------------------------------ - /// @copydoc DataBuffer::GetBytes() - //------------------------------------------------------------------ - uint8_t *GetBytes() override; - - //------------------------------------------------------------------ - /// @copydoc DataBuffer::GetBytes() const - //------------------------------------------------------------------ - const uint8_t *GetBytes() const override; - - //------------------------------------------------------------------ - /// @copydoc DataBuffer::GetByteSize() const - //------------------------------------------------------------------ - lldb::offset_t GetByteSize() const override; - - //------------------------------------------------------------------ - /// Error get accessor. - /// - /// @return - /// A const reference to Error object in case memory mapping - /// fails. - //------------------------------------------------------------------ - const Error &GetError() const; - - //------------------------------------------------------------------ - /// Memory map all or part of a file. - /// - /// Memory map \a length bytes from \a file starting \a offset - /// bytes into the file. If \a length is set to \c SIZE_MAX, - /// then map as many bytes as possible. - /// - /// @param[in] file - /// The file specification from which to map data. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. Even though it may be possible - /// for a 32-bit host debugger to debug a 64-bit target, size_t - /// still dictates the maximum possible size that can be mapped - /// into this process. For this kind of cross-arch debugging - /// scenario, mappings and views should be managed at a higher - /// level. - /// - /// @return - /// The number of bytes mapped starting from the \a offset. - //------------------------------------------------------------------ - size_t MemoryMapFromFileSpec(const FileSpec *file, lldb::offset_t offset = 0, - size_t length = SIZE_MAX, - bool writeable = false); - - //------------------------------------------------------------------ - /// Memory map all or part of a file. - /// - /// Memory map \a length bytes from an opened file descriptor \a fd - /// starting \a offset bytes into the file. If \a length is set to - /// \c SIZE_MAX, then map as many bytes as possible. - /// - /// @param[in] fd - /// The posix file descriptor for an already opened file - /// from which to map data. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// The number of bytes mapped starting from the \a offset. - //------------------------------------------------------------------ - size_t MemoryMapFromFileDescriptor(int fd, lldb::offset_t offset, - size_t length, bool write, - bool fd_is_file); - -protected: - //------------------------------------------------------------------ - // Classes that inherit from DataBufferMemoryMap can see and modify these - //------------------------------------------------------------------ - uint8_t *m_mmap_addr; ///< The actual pointer that was returned from \c mmap() - size_t m_mmap_size; ///< The actual number of bytes that were mapped when \c - ///mmap() was called - uint8_t *m_data; ///< The data the user requested somewhere within the memory - ///mapped data. - lldb::offset_t - m_size; ///< The size of the data the user got when data was requested - -private: - DISALLOW_COPY_AND_ASSIGN(DataBufferMemoryMap); -}; - -} // namespace lldb_private - -#endif // liblldb_DataBufferMemoryMap_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Debugger.h b/contrib/llvm/tools/lldb/include/lldb/Core/Debugger.h index ccc07b3..34d35ff 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Debugger.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Debugger.h @@ -14,9 +14,7 @@ #include <stdint.h> // C++ Includes -#include <map> #include <memory> -#include <mutex> #include <vector> // Other libraries and framework includes @@ -24,21 +22,55 @@ #include "lldb/Core/Broadcaster.h" #include "lldb/Core/FormatEntity.h" #include "lldb/Core/IOHandler.h" -#include "lldb/Core/Listener.h" #include "lldb/Core/SourceManager.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/Terminal.h" +#include "lldb/Target/ExecutionContext.h" // for ExecutionContext #include "lldb/Target/Platform.h" #include "lldb/Target/TargetList.h" -#include "lldb/lldb-public.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Status.h" // for Status +#include "lldb/Utility/UserID.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ScriptLanguage, Langua... +#include "lldb/lldb-forward.h" // for StreamFileSP, DebuggerSP +#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType +#include "lldb/lldb-private-types.h" // for LoadPluginCallbackType +#include "lldb/lldb-types.h" // for LogOutputCallback, thr... + +#include "llvm/ADT/ArrayRef.h" // for ArrayRef +#include "llvm/ADT/StringMap.h" // for StringMap +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/DynamicLibrary.h" // for DynamicLibrary +#include "llvm/Support/Threading.h" + +#include <assert.h> // for assert +#include <stddef.h> // for size_t +#include <stdio.h> +namespace lldb_private { +class Address; +} +namespace lldb_private { +class CommandInterpreter; +} +namespace lldb_private { +class Process; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class Target; +} namespace llvm { -namespace sys { -class DynamicLibrary; -} // namespace sys -} // namespace llvm +class raw_ostream; +} namespace lldb_private { @@ -190,9 +222,10 @@ public: void SetCloseInputOnEOF(bool b); - bool EnableLog(const char *channel, const char **categories, - const char *log_file, uint32_t log_options, - Stream &error_stream); + bool EnableLog(llvm::StringRef channel, + llvm::ArrayRef<const char *> categories, + llvm::StringRef log_file, uint32_t log_options, + llvm::raw_ostream &error_stream); void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); @@ -206,9 +239,9 @@ public: eStopDisassemblyTypeAlways }; - Error SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef property_path, - llvm::StringRef value) override; + Status SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, llvm::StringRef property_path, + llvm::StringRef value) override; bool GetAutoConfirm() const; @@ -216,6 +249,8 @@ public: const FormatEntity::Entry *GetFrameFormat() const; + const FormatEntity::Entry *GetFrameFormatUnique() const; + const FormatEntity::Entry *GetThreadFormat() const; const FormatEntity::Entry *GetThreadStopFormat() const; @@ -273,7 +308,7 @@ public: const ConstString &GetInstanceName() { return m_instance_name; } - bool LoadPlugin(const FileSpec &spec, Error &error); + bool LoadPlugin(const FileSpec &spec, Status &error); void ExecuteIOHandlers(); @@ -285,7 +320,7 @@ public: bool IsHandlingEvents() const { return m_event_handler_thread.IsJoinable(); } - Error RunREPL(lldb::LanguageType language, const char *repl_options); + Status RunREPL(lldb::LanguageType language, const char *repl_options); // This is for use in the command interpreter, when you either want the // selected target, or if no target @@ -363,9 +398,8 @@ protected: std::unique_ptr<CommandInterpreter> m_command_interpreter_ap; IOHandlerStack m_input_reader_stack; - typedef std::map<std::string, lldb::StreamWP> LogStreamMap; - LogStreamMap m_log_streams; - lldb::StreamSP m_log_callback_stream_sp; + llvm::StringMap<std::weak_ptr<llvm::raw_ostream>> m_log_streams; + std::shared_ptr<llvm::raw_ostream> m_log_callback_stream_sp; ConstString m_instance_name; static LoadPluginCallbackType g_load_plugin_callback; typedef std::vector<llvm::sys::DynamicLibrary> LoadedPluginsList; @@ -374,7 +408,7 @@ protected: HostThread m_io_handler_thread; Broadcaster m_sync_broadcaster; lldb::ListenerSP m_forward_listener_sp; - std::once_flag m_clear_once; + llvm::once_flag m_clear_once; //---------------------------------------------------------------------- // Events for m_sync_broadcaster diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Disassembler.h b/contrib/llvm/tools/lldb/include/lldb/Core/Disassembler.h index c420747..addc83a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Disassembler.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Disassembler.h @@ -10,22 +10,68 @@ #ifndef liblldb_Disassembler_h_ #define liblldb_Disassembler_h_ -// C Includes -// C++ Includes -#include <string> -#include <vector> - -// Other libraries and framework includes -// Project includes #include "lldb/Core/Address.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/EmulateInstruction.h" +#include "lldb/Core/FormatEntity.h" // for FormatEntity #include "lldb/Core/Opcode.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Symbol/LineEntry.h" -#include "lldb/lldb-private.h" +#include "lldb/Target/ExecutionContext.h" // for ExecutionContext +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for AddressClass, AddressClass... +#include "lldb/lldb-forward.h" // for InstructionSP, DisassemblerSP +#include "lldb/lldb-types.h" // for addr_t, offset_t + +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <functional> // for function +#include <map> +#include <memory> // for enable_shared_from_this +#include <set> +#include <string> +#include <vector> + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int64_t +#include <stdio.h> // for FILE + +namespace lldb_private { +class AddressRange; +} +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Debugger; +} +namespace lldb_private { +class Disassembler; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +struct RegisterInfo; +} +namespace llvm { +template <typename T> class SmallVectorImpl; +} namespace lldb_private { @@ -127,6 +173,8 @@ public: virtual bool HasDelaySlot(); + bool CanSetBreakpoint (); + virtual size_t Decode(const Disassembler &disassembler, const DataExtractor &data, lldb::offset_t data_offset) = 0; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/DumpDataExtractor.h b/contrib/llvm/tools/lldb/include/lldb/Core/DumpDataExtractor.h new file mode 100644 index 0000000..46e676c --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Core/DumpDataExtractor.h @@ -0,0 +1,95 @@ +//===-- DumpDataExtractor.h -------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_CORE_DUMPDATAEXTRACTOR_H +#define LLDB_CORE_DUMPDATAEXTRACTOR_H + +#include "lldb/lldb-enumerations.h" // for Format +#include "lldb/lldb-types.h" + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class DataExtractor; +class ExecutionContextScope; +class Stream; + +//------------------------------------------------------------------ +/// Dumps \a item_count objects into the stream \a s. +/// +/// Dumps \a item_count objects using \a item_format, each of which +/// are \a item_byte_size bytes long starting at offset \a offset +/// bytes into the contained data, into the stream \a s. \a +/// num_per_line objects will be dumped on each line before a new +/// line will be output. If \a base_addr is a valid address, then +/// each new line of output will be preceded by the address value +/// plus appropriate offset, and a colon and space. Bitfield values +/// can be dumped by calling this function multiple times with the +/// same start offset, format and size, yet differing \a +/// item_bit_size and \a item_bit_offset values. +/// +/// @param[in] s +/// The stream to dump the output to. This value can not be nullptr. +/// +/// @param[in] offset +/// The offset into the data at which to start dumping. +/// +/// @param[in] item_format +/// The format to use when dumping each item. +/// +/// @param[in] item_byte_size +/// The byte size of each item. +/// +/// @param[in] item_count +/// The number of items to dump. +/// +/// @param[in] num_per_line +/// The number of items to display on each line. +/// +/// @param[in] base_addr +/// The base address that gets added to the offset displayed on +/// each line if the value is valid. Is \a base_addr is +/// LLDB_INVALID_ADDRESS then no address values will be prepended +/// to any lines. +/// +/// @param[in] item_bit_size +/// If the value to display is a bitfield, this value should +/// be the number of bits that the bitfield item has within the +/// item's byte size value. This function will need to be called +/// multiple times with identical \a offset and \a item_byte_size +/// values in order to display multiple bitfield values that +/// exist within the same integer value. If the items being +/// displayed are not bitfields, this value should be zero. +/// +/// @param[in] item_bit_offset +/// If the value to display is a bitfield, this value should +/// be the offset in bits, or shift right amount, that the +/// bitfield item occupies within the item's byte size value. +/// This function will need to be called multiple times with +/// identical \a offset and \a item_byte_size values in order +/// to display multiple bitfield values that exist within the +/// same integer value. If the items being displayed are not +/// bitfields, this value should be zero. +/// +/// @return +/// The offset at which dumping ended. +//------------------------------------------------------------------ +lldb::offset_t +DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset, + lldb::Format item_format, size_t item_byte_size, + size_t item_count, size_t num_per_line, uint64_t base_addr, + uint32_t item_bit_size, uint32_t item_bit_offset, + ExecutionContextScope *exe_scope = nullptr); + +void DumpHexBytes(Stream *s, const void *src, size_t src_len, + uint32_t bytes_per_line, lldb::addr_t base_addr); +} + +#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/EmulateInstruction.h b/contrib/llvm/tools/lldb/include/lldb/Core/EmulateInstruction.h index 90e66d6..bfc9ef0 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/EmulateInstruction.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/EmulateInstruction.h @@ -15,9 +15,34 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Opcode.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/RegisterValue.h" -#include "lldb/lldb-private.h" -#include "lldb/lldb-public.h" + +#include "lldb/Core/Address.h" // for Address +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for RegisterKind, ByteOrder +#include "lldb/lldb-private-enumerations.h" // for InstructionType +#include "lldb/lldb-private-types.h" // for RegisterInfo +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int64_t +namespace lldb_private { +class OptionValueDictionary; +} +namespace lldb_private { +class RegisterContext; +} +namespace lldb_private { +class RegisterValue; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +class UnwindPlan; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Event.h b/contrib/llvm/tools/lldb/include/lldb/Core/Event.h index 049bb3c..f4c7f47 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Event.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Event.h @@ -10,19 +10,28 @@ #ifndef liblldb_Event_h_ #define liblldb_Event_h_ -// C Includes -// C++ Includes +#include "lldb/Core/Broadcaster.h" +#include "lldb/Host/Predicate.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for EventDataSP, ProcessSP, Struct... + +#include "llvm/ADT/StringRef.h" // for StringRef + #include <chrono> #include <memory> #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Broadcaster.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/StructuredData.h" -#include "lldb/Host/Predicate.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Event; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/FileLineResolver.h b/contrib/llvm/tools/lldb/include/lldb/Core/FileLineResolver.h index e9e20c5..54bce4f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/FileLineResolver.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/FileLineResolver.h @@ -10,9 +10,19 @@ #ifndef liblldb_FileLineResolver_h_ #define liblldb_FileLineResolver_h_ -// Project includes -#include "lldb/Core/AddressResolver.h" +#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::CallbackR... #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN + +#include <stdint.h> // for uint32_t, UINT32_MAX + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/FileSpecList.h b/contrib/llvm/tools/lldb/include/lldb/Core/FileSpecList.h index 75995d1..3cbffca 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/FileSpecList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/FileSpecList.h @@ -11,10 +11,16 @@ #define liblldb_FileSpecList_h_ #if defined(__cplusplus) -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/FileSpec.h" + #include <vector> +#include <stddef.h> // for size_t + +namespace lldb_private { +class Stream; +} + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/FormatEntity.h b/contrib/llvm/tools/lldb/include/lldb/Core/FormatEntity.h index b6fe9ea..aa5ccb4 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/FormatEntity.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/FormatEntity.h @@ -10,19 +10,38 @@ #ifndef liblldb_FormatEntity_h_ #define liblldb_FormatEntity_h_ -// C Includes -// C++ Includes +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Status.h" +#include "lldb/lldb-enumerations.h" // for Format::eFormatDefault, Format +#include "lldb/lldb-types.h" // for addr_t +#include <algorithm> // for min +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + #include <string> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Error.h" -#include "lldb/lldb-private.h" - +namespace lldb_private { +class Address; +} +namespace lldb_private { +class ExecutionContext; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class StringList; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class ValueObject; +} namespace llvm { class StringRef; -} // namespace llvm +} namespace lldb_private { class FormatEntity { @@ -186,11 +205,11 @@ public: const Address *addr, ValueObject *valobj, bool function_changed, bool initial_function); - static Error Parse(const llvm::StringRef &format, Entry &entry); + static Status Parse(const llvm::StringRef &format, Entry &entry); - static Error ExtractVariableInfo(llvm::StringRef &format_str, - llvm::StringRef &variable_name, - llvm::StringRef &variable_format); + static Status ExtractVariableInfo(llvm::StringRef &format_str, + llvm::StringRef &variable_name, + llvm::StringRef &variable_format); static size_t AutoComplete(llvm::StringRef s, int match_start_point, int max_return_elements, bool &word_complete, @@ -209,8 +228,8 @@ public: llvm::StringRef element_format); protected: - static Error ParseInternal(llvm::StringRef &format, Entry &parent_entry, - uint32_t depth); + static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry, + uint32_t depth); }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/IOHandler.h b/contrib/llvm/tools/lldb/include/lldb/Core/IOHandler.h index 2e6ff31..ebf56d7 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/IOHandler.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/IOHandler.h @@ -10,26 +10,27 @@ #ifndef liblldb_IOHandler_h_ #define liblldb_IOHandler_h_ -// C Includes -#include <string.h> +#include "lldb/Core/ValueObjectList.h" +#include "lldb/Host/Predicate.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Flags.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StringList.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for IOHandlerSP, StreamFileSP +#include "llvm/ADT/StringRef.h" // for StringRef -// C++ Includes #include <memory> #include <mutex> #include <string> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Flags.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StringList.h" -#include "lldb/Core/ValueObjectList.h" -#include "lldb/Host/Predicate.h" -#include "lldb/lldb-enumerations.h" -#include "lldb/lldb-public.h" +#include <stdint.h> // for uint32_t +#include <stdio.h> // for FILE + +namespace lldb_private { +class Debugger; +} namespace curses { class Application; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Listener.h b/contrib/llvm/tools/lldb/include/lldb/Core/Listener.h index b82844e..3d12f8f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Listener.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Listener.h @@ -10,20 +10,29 @@ #ifndef liblldb_Select_h_ #define liblldb_Select_h_ -// C Includes -// C++ Includes -#include <chrono> +#include "lldb/Core/Broadcaster.h" // for Broadcaster::BroadcasterImplWP +#include "lldb/Utility/Timeout.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for BroadcasterManagerWP, EventSP + +#include <condition_variable> #include <list> #include <map> +#include <memory> // for owner_less, enable_shared_from_this #include <mutex> +#include <ratio> // for micro #include <string> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Event.h" -#include "lldb/Utility/Timeout.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class Event; +} namespace lldb_private { @@ -39,8 +48,7 @@ public: //------------------------------------------------------------------ // // Listeners have to be constructed into shared pointers - at least if you - // want them to listen to - // Broadcasters, + // want them to listen to Broadcasters, protected: Listener(const char *name); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Log.h b/contrib/llvm/tools/lldb/include/lldb/Core/Log.h deleted file mode 100644 index d87c263..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Log.h +++ /dev/null @@ -1,189 +0,0 @@ -//===-- Log.h ---------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_Log_h_ -#define liblldb_Log_h_ - -// C Includes -#include <signal.h> -#include <stdarg.h> -#include <stdint.h> -#include <stdio.h> - -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Flags.h" -#include "lldb/Core/Logging.h" -#include "lldb/Core/PluginInterface.h" -#include "lldb/lldb-private.h" - -#include "llvm/Support/FormatVariadic.h" - -//---------------------------------------------------------------------- -// Logging Options -//---------------------------------------------------------------------- -#define LLDB_LOG_OPTION_THREADSAFE (1u << 0) -#define LLDB_LOG_OPTION_VERBOSE (1u << 1) -#define LLDB_LOG_OPTION_DEBUG (1u << 2) -#define LLDB_LOG_OPTION_PREPEND_SEQUENCE (1u << 3) -#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP (1u << 4) -#define LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD (1u << 5) -#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME (1U << 6) -#define LLDB_LOG_OPTION_BACKTRACE (1U << 7) -#define LLDB_LOG_OPTION_APPEND (1U << 8) - -//---------------------------------------------------------------------- -// Logging Functions -//---------------------------------------------------------------------- -namespace lldb_private { - -class Log final { -public: - //------------------------------------------------------------------ - // Callback definitions for abstracted plug-in log access. - //------------------------------------------------------------------ - typedef void (*DisableCallback)(const char **categories, - Stream *feedback_strm); - typedef Log *(*EnableCallback)(lldb::StreamSP &log_stream_sp, - uint32_t log_options, const char **categories, - Stream *feedback_strm); - typedef void (*ListCategoriesCallback)(Stream *strm); - - struct Callbacks { - DisableCallback disable; - EnableCallback enable; - ListCategoriesCallback list_categories; - }; - - //------------------------------------------------------------------ - // Static accessors for logging channels - //------------------------------------------------------------------ - static void RegisterLogChannel(const ConstString &channel, - const Log::Callbacks &log_callbacks); - - static bool UnregisterLogChannel(const ConstString &channel); - - static bool GetLogChannelCallbacks(const ConstString &channel, - Log::Callbacks &log_callbacks); - - static bool EnableLogChannel(lldb::StreamSP &log_stream_sp, - uint32_t log_options, const char *channel, - const char **categories, Stream &error_stream); - - static void EnableAllLogChannels(lldb::StreamSP &log_stream_sp, - uint32_t log_options, - const char **categories, - Stream *feedback_strm); - - static void DisableAllLogChannels(Stream *feedback_strm); - - static void ListAllLogChannels(Stream *strm); - - static void Initialize(); - - static void Terminate(); - - //------------------------------------------------------------------ - // Auto completion - //------------------------------------------------------------------ - static void AutoCompleteChannelName(const char *channel_name, - StringList &matches); - - //------------------------------------------------------------------ - // Member functions - //------------------------------------------------------------------ - Log(); - - Log(const lldb::StreamSP &stream_sp); - - ~Log(); - - void PutCString(const char *cstr); - void PutString(llvm::StringRef str); - - template <typename... Args> void Format(const char *fmt, Args &&... args) { - PutString(llvm::formatv(fmt, std::forward<Args>(args)...).str()); - } - - // CLEANUP: Add llvm::raw_ostream &Stream() function. - void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); - - void VAPrintf(const char *format, va_list args); - - void LogIf(uint32_t mask, const char *fmt, ...) - __attribute__((format(printf, 3, 4))); - - void Debug(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - void VAError(const char *format, va_list args); - - void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - void Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3))); - - Flags &GetOptions(); - - const Flags &GetOptions() const; - - Flags &GetMask(); - - const Flags &GetMask() const; - - bool GetVerbose() const; - - bool GetDebug() const; - - void SetStream(const lldb::StreamSP &stream_sp) { m_stream_sp = stream_sp; } - -protected: - //------------------------------------------------------------------ - // Member variables - //------------------------------------------------------------------ - lldb::StreamSP m_stream_sp; - Flags m_options; - Flags m_mask_bits; - -private: - DISALLOW_COPY_AND_ASSIGN(Log); -}; - -class LogChannel : public PluginInterface { -public: - LogChannel(); - - ~LogChannel() override; - - static lldb::LogChannelSP FindPlugin(const char *plugin_name); - - // categories is an array of chars that ends with a NULL element. - virtual void Disable(const char **categories, Stream *feedback_strm) = 0; - - virtual bool - Enable(lldb::StreamSP &log_stream_sp, uint32_t log_options, - Stream *feedback_strm, // Feedback stream for argument errors etc - const char **categories) = 0; // The categories to enable within this - // logging stream, if empty, enable - // default set - - virtual void ListCategories(Stream *strm) = 0; - -protected: - std::unique_ptr<Log> m_log_ap; - -private: - DISALLOW_COPY_AND_ASSIGN(LogChannel); -}; - -} // namespace lldb_private - -#endif // liblldb_Log_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Mangled.h b/contrib/llvm/tools/lldb/include/lldb/Core/Mangled.h index 4170b70..22778fa 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Mangled.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Mangled.h @@ -11,9 +11,18 @@ #define liblldb_Mangled_h_ #if defined(__cplusplus) -#include "lldb/Core/ConstString.h" -#include "lldb/lldb-private.h" -#include <vector> +#include "lldb/Utility/ConstString.h" +#include "lldb/lldb-enumerations.h" // for LanguageType +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <stddef.h> // for size_t + +namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/MappedHash.h b/contrib/llvm/tools/lldb/include/lldb/Core/MappedHash.h index 842a116..18d383e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/MappedHash.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/MappedHash.h @@ -22,8 +22,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Stream.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Stream.h" class MappedHash { public: @@ -326,7 +326,7 @@ public: 1u, // Bucket hash data collision, but key didn't match eResultEndOfHashData = 2u, // The chain of items for this hash data in // this bucket is terminated, search no more - eResultError = 3u // Error parsing the hash data, abort + eResultError = 3u // Status parsing the hash data, abort }; struct Pair { @@ -353,7 +353,7 @@ public: bool IsValid() const { return m_header.version == 1 && m_header.hash_function == eHashFunctionDJB && - m_header.bucket_count > 0 && m_header.hashes_count > 0; + m_header.bucket_count > 0; } uint32_t GetHashIndex(uint32_t bucket_idx) const { @@ -409,7 +409,7 @@ public: // searching return false; case eResultError: - // Error parsing the hash data, abort + // Status parsing the hash data, abort return false; } } diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Module.h b/contrib/llvm/tools/lldb/include/lldb/Core/Module.h index 90d75b6..2ffe57a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Module.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Module.h @@ -10,29 +10,86 @@ #ifndef liblldb_Module_h_ #define liblldb_Module_h_ -#include "lldb/Symbol/SymbolContextScope.h" - -// Project includes +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/UUID.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Core/ModuleSpec.h" // for ModuleSpec +#include "lldb/Symbol/SymbolContextScope.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/PathMappingList.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" // for Status +#include "lldb/Utility/UUID.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for LanguageType, SymbolType #include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" // for addr_t, offset_t -// Other libraries and framework includes #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/Chrono.h" -// C Includes -// C++ Includes #include <atomic> +#include <memory> // for enable_shared_from_this #include <mutex> +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t #include <string> #include <vector> namespace lldb_private { +class CompilerDeclContext; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class Log; +} +namespace lldb_private { +class ObjectFile; +} +namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Symbol; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class SymbolFile; +} +namespace lldb_private { +class SymbolVendor; +} +namespace lldb_private { +class Symtab; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +class TypeList; +} +namespace lldb_private { +class TypeMap; +} +namespace lldb_private { +class VariableList; +} + +namespace lldb_private { //---------------------------------------------------------------------- /// @class Module Module.h "lldb/Core/Module.h" @@ -557,6 +614,8 @@ public: const FileSpec &GetSymbolFileFileSpec() const { return m_symfile_spec; } + void PreloadSymbols(); + void SetSymbolFileFileSpec(const FileSpec &file); const llvm::sys::TimePoint<> &GetModificationTime() const { @@ -593,7 +652,7 @@ public: //------------------------------------------------------------------ bool IsLoadedInTarget(Target *target); - bool LoadScriptingResourceInTarget(Target *target, Error &error, + bool LoadScriptingResourceInTarget(Target *target, Status &error, Stream *feedback_stream = nullptr); //------------------------------------------------------------------ @@ -669,7 +728,7 @@ public: /// failed (see the `error` for more information in that case). //------------------------------------------------------------------ ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp, - lldb::addr_t header_addr, Error &error, + lldb::addr_t header_addr, Status &error, size_t size_to_read = 512); //------------------------------------------------------------------ /// Get the symbol vendor interface for the current architecture. @@ -962,6 +1021,20 @@ public: bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const; bool RemapSourceFile(const char *, std::string &) const = delete; + //------------------------------------------------------------------ + /// Loads this module to memory. + /// + /// Loads the bits needed to create an executable image to the memory. + /// It is useful with bare-metal targets where target does not have the + /// ability to start a process itself. + /// + /// @param[in] target + /// Target where to load the module. + /// + /// @return + //------------------------------------------------------------------ + Status LoadInMemory(Target &target, bool set_pc); + //---------------------------------------------------------------------- /// @class LookupInfo Module.h "lldb/Core/Module.h" /// @brief A class that encapsulates name lookup information. diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ModuleChild.h b/contrib/llvm/tools/lldb/include/lldb/Core/ModuleChild.h index f47c5ca..8f2985c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ModuleChild.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ModuleChild.h @@ -10,7 +10,7 @@ #ifndef liblldb_ModuleChild_h_ #define liblldb_ModuleChild_h_ -#include "lldb/lldb-private.h" +#include "lldb/lldb-forward.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ModuleList.h b/contrib/llvm/tools/lldb/include/lldb/Core/ModuleList.h index 4aa1674..4b637c9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ModuleList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ModuleList.h @@ -10,18 +10,67 @@ #ifndef liblldb_ModuleList_h_ #define liblldb_ModuleList_h_ -// C Includes -// C++ Includes +#include "lldb/Core/Address.h" // for Address +#include "lldb/Core/ModuleSpec.h" // for ModuleSpec +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Iterable.h" +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" + +#include "llvm/ADT/DenseSet.h" + #include <functional> #include <list> #include <mutex> #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Utility/Iterable.h" -#include "lldb/lldb-private.h" -#include "llvm/ADT/DenseSet.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class FileSpecList; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class SymbolFile; +} +namespace lldb_private { +class Target; +} +namespace lldb_private { +class TypeList; +} +namespace lldb_private { +class UUID; +} +namespace lldb_private { +class VariableList; +} namespace lldb_private { @@ -481,18 +530,18 @@ public: //------------------------------------------------------------------ size_t GetSize() const; - bool LoadScriptingResourcesInTarget(Target *target, std::list<Error> &errors, + bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors, Stream *feedback_stream = nullptr, bool continue_on_error = true); static bool ModuleIsInCache(const Module *module_ptr); - static Error GetSharedModule(const ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - lldb::ModuleSP *old_module_sp_ptr, - bool *did_create_ptr, - bool always_create = false); + static Status GetSharedModule(const ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + lldb::ModuleSP *old_module_sp_ptr, + bool *did_create_ptr, + bool always_create = false); static bool RemoveSharedModule(lldb::ModuleSP &module_sp); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ModuleSpec.h b/contrib/llvm/tools/lldb/include/lldb/Core/ModuleSpec.h index 6a9e604..ce851d8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ModuleSpec.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ModuleSpec.h @@ -12,10 +12,10 @@ // Project includes #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/UUID.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Target/PathMappingList.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/UUID.h" // Other libraries and framework includes #include "llvm/Support/Chrono.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Opcode.h b/contrib/llvm/tools/lldb/include/lldb/Core/Opcode.h index d5376d4..3385745 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Opcode.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Opcode.h @@ -10,20 +10,25 @@ #ifndef lldb_Opcode_h #define lldb_Opcode_h -// C Includes -#include <string.h> +#include "lldb/Utility/Endian.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder, ByteOrder::eByteOrde... -// C++ Includes -// Other libraries and framework includes #include "llvm/Support/MathExtras.h" -// Project includes -#include "lldb/Host/Endian.h" -#include "lldb/lldb-public.h" +#include <assert.h> // for assert +#include <stdint.h> // for uint32_t, uint8_t, uint16_t +#include <string.h> + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Stream; +} namespace lldb { class SBInstruction; -} // namespace lldb +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/PluginManager.h b/contrib/llvm/tools/lldb/include/lldb/Core/PluginManager.h index e0de65a..d9851e5 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/PluginManager.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/PluginManager.h @@ -10,13 +10,28 @@ #ifndef liblldb_PluginManager_h_ #define liblldb_PluginManager_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-enumerations.h" // for ScriptLanguage +#include "lldb/lldb-forward.h" // for OptionValuePropertiesSP +#include "lldb/lldb-private-interfaces.h" // for DebuggerInitializeCallback +#include "llvm/ADT/StringRef.h" // for StringRef +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class CommandInterpreter; +} +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class Debugger; +} +namespace lldb_private { +class StringList; +} namespace lldb_private { class PluginManager { @@ -187,8 +202,8 @@ public: static ObjectFileCreateMemoryInstance GetObjectFileCreateMemoryCallbackForPluginName(const ConstString &name); - static Error SaveCore(const lldb::ProcessSP &process_sp, - const FileSpec &outfile); + static Status SaveCore(const lldb::ProcessSP &process_sp, + const FileSpec &outfile); //------------------------------------------------------------------ // ObjectContainer @@ -210,22 +225,6 @@ public: GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx); //------------------------------------------------------------------ - // LogChannel - //------------------------------------------------------------------ - static bool RegisterPlugin(const ConstString &name, const char *description, - LogChannelCreateInstance create_callback); - - static bool UnregisterPlugin(LogChannelCreateInstance create_callback); - - static LogChannelCreateInstance - GetLogChannelCreateCallbackAtIndex(uint32_t idx); - - static LogChannelCreateInstance - GetLogChannelCreateCallbackForPluginName(const ConstString &name); - - static const char *GetLogChannelCreateNameAtIndex(uint32_t idx); - - //------------------------------------------------------------------ // Platform //------------------------------------------------------------------ static bool diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/RangeMap.h b/contrib/llvm/tools/lldb/include/lldb/Core/RangeMap.h index 73a949f..e37dcd7 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/RangeMap.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/RangeMap.h @@ -59,6 +59,18 @@ template <typename B, typename S> struct Range { void Slide(BaseType slide) { base += slide; } + bool Union(const Range &rhs) + { + if (DoesAdjoinOrIntersect(rhs)) + { + auto new_end = std::max<BaseType>(GetRangeEnd(), rhs.GetRangeEnd()); + base = std::min<BaseType>(base, rhs.base); + size = new_end - base; + return true; + } + return false; + } + BaseType GetRangeEnd() const { return base + size; } void SetRangeEnd(BaseType end) { @@ -348,7 +360,33 @@ public: void Append(B base, S size) { m_entries.emplace_back(base, size); } - bool RemoveEntrtAtIndex(uint32_t idx) { + // Insert an item into a sorted list and optionally combine it with any + // adjacent blocks if requested. + void Insert(const Entry &entry, bool combine) { + if (m_entries.empty()) { + m_entries.push_back(entry); + return; + } + auto begin = m_entries.begin(); + auto end = m_entries.end(); + auto pos = std::lower_bound(begin, end, entry); + if (combine) { + if (pos != end && pos->Union(entry)) { + CombinePrevAndNext(pos); + return; + } + if (pos != begin) { + auto prev = pos - 1; + if (prev->Union(entry)) { + CombinePrevAndNext(prev); + return; + } + } + } + m_entries.insert(pos, entry); + } + + bool RemoveEntryAtIndex(uint32_t idx) { if (idx < m_entries.size()) { m_entries.erase(m_entries.begin() + idx); return true; @@ -458,6 +496,7 @@ public: // Clients must ensure that "i" is a valid index prior to calling this // function + Entry &GetEntryRef(size_t i) { return m_entries[i]; } const Entry &GetEntryRef(size_t i) const { return m_entries[i]; } Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); } @@ -538,6 +577,28 @@ public: } protected: + + void CombinePrevAndNext(typename Collection::iterator pos) { + // Check if the prev or next entries in case they need to be unioned with + // the entry pointed to by "pos". + if (pos != m_entries.begin()) { + auto prev = pos - 1; + if (prev->Union(*pos)) + m_entries.erase(pos); + pos = prev; + } + + auto end = m_entries.end(); + if (pos != end) { + auto next = pos + 1; + if (next != end) { + if (pos->Union(*next)) + m_entries.erase(next); + } + } + return; + } + Collection m_entries; }; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/RegisterValue.h b/contrib/llvm/tools/lldb/include/lldb/Core/RegisterValue.h index 78dfbea..a45db00 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/RegisterValue.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/RegisterValue.h @@ -10,20 +10,28 @@ #ifndef lldb_RegisterValue_h #define lldb_RegisterValue_h -// C Includes -#include <string.h> +#include "lldb/Core/Scalar.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-enumerations.h" // for ByteOrder, Format +#include "lldb/lldb-types.h" // for offset_t -// C++ Includes -// Other libraries and framework includes #include "llvm/ADT/APInt.h" +#include "llvm/ADT/StringRef.h" // for StringRef -// Project includes -#include "lldb/Core/Scalar.h" -#include "lldb/Host/Endian.h" -#include "lldb/lldb-private.h" -#include "lldb/lldb-public.h" +#include <stdint.h> // for uint32_t, uint8_t, uint64_t, uin... +#include <string.h> namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +struct RegisterInfo; +} +namespace lldb_private { class RegisterValue { public: @@ -97,11 +105,11 @@ public: // into "dst". uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, - Error &error) const; + Status &error) const; uint32_t SetFromMemoryData(const RegisterInfo *reg_info, const void *src, uint32_t src_len, lldb::ByteOrder src_byte_order, - Error &error); + Status &error); bool GetScalarValue(Scalar &scalar) const; @@ -233,13 +241,13 @@ public: bool SignExtend(uint32_t sign_bitpos); - Error SetValueFromString(const RegisterInfo *reg_info, - llvm::StringRef value_str); - Error SetValueFromString(const RegisterInfo *reg_info, - const char *value_str) = delete; + Status SetValueFromString(const RegisterInfo *reg_info, + llvm::StringRef value_str); + Status SetValueFromString(const RegisterInfo *reg_info, + const char *value_str) = delete; - Error SetValueFromData(const RegisterInfo *reg_info, DataExtractor &data, - lldb::offset_t offset, bool partial_data_ok); + Status SetValueFromData(const RegisterInfo *reg_info, DataExtractor &data, + lldb::offset_t offset, bool partial_data_ok); // The default value of 0 for reg_name_right_align_at means no alignment at // all. diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Scalar.h b/contrib/llvm/tools/lldb/include/lldb/Core/Scalar.h index cee2577..943398b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Scalar.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Scalar.h @@ -10,10 +10,23 @@ #ifndef liblldb_Scalar_h_ #define liblldb_Scalar_h_ -#include "lldb/lldb-private.h" +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-enumerations.h" // for Encoding, ByteOrder +#include "lldb/lldb-private-types.h" // for type128 + #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int64_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Stream; +} + #define NUM_OF_WORDS_INT128 2 #define BITWIDTH_INT128 128 #define NUM_OF_WORDS_INT256 4 @@ -133,7 +146,7 @@ public: bool GetData(DataExtractor &data, size_t limit_byte_size = UINT32_MAX) const; size_t GetAsMemoryData(void *dst, size_t dst_len, - lldb::ByteOrder dst_byte_order, Error &error) const; + lldb::ByteOrder dst_byte_order, Status &error) const; bool IsZero() const; @@ -259,11 +272,11 @@ public: long double LongDouble(long double fail_value = 0.0) const; - Error SetValueFromCString(const char *s, lldb::Encoding encoding, - size_t byte_size); + Status SetValueFromCString(const char *s, lldb::Encoding encoding, + size_t byte_size); - Error SetValueFromData(DataExtractor &data, lldb::Encoding encoding, - size_t byte_size); + Status SetValueFromData(DataExtractor &data, lldb::Encoding encoding, + size_t byte_size); static bool UIntValueIsValidForSize(uint64_t uval64, size_t total_byte_size) { if (total_byte_size > 8) diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/SearchFilter.h b/contrib/llvm/tools/lldb/include/lldb/Core/SearchFilter.h index 6b3a79e..5861afc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/SearchFilter.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/SearchFilter.h @@ -10,13 +10,44 @@ #ifndef liblldb_SearchFilter_h_ #define liblldb_SearchFilter_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/FileSpecList.h" -#include "lldb/Core/StructuredData.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/StructuredData.h" + +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-forward.h" // for SearchFilterSP, TargetSP, Modu... + +#include <stdint.h> // for uint32_t + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class Breakpoint; +} +namespace lldb_private { +class CompileUnit; +} +namespace lldb_private { +class Status; +} +namespace lldb_private { +class Function; +} +namespace lldb_private { +class ModuleList; +} +namespace lldb_private { +class SearchFilter; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class Target; +} namespace lldb_private { @@ -219,7 +250,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); virtual StructuredData::ObjectSP SerializeToStructuredData() { return StructuredData::ObjectSP(); @@ -254,7 +285,7 @@ public: static const char *FilterTyToName(enum FilterTy); - static FilterTy NameToFilterTy(const char *name); + static FilterTy NameToFilterTy(llvm::StringRef name); protected: // Serialization of SearchFilter options: @@ -320,7 +351,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -374,7 +405,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -431,7 +462,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; @@ -484,7 +515,7 @@ public: static lldb::SearchFilterSP CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Section.h b/contrib/llvm/tools/lldb/include/lldb/Core/Section.h index 5afaa11..0466693 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Section.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Section.h @@ -10,16 +10,39 @@ #ifndef liblldb_Section_h_ #define liblldb_Section_h_ -#include "lldb/Core/AddressRange.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Flags.h" #include "lldb/Core/ModuleChild.h" -#include "lldb/Core/RangeMap.h" -#include "lldb/Core/UserID.h" -#include "lldb/Core/VMRange.h" -#include "lldb/Symbol/ObjectFile.h" -#include "lldb/lldb-private.h" -#include <limits.h> +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Flags.h" +#include "lldb/Utility/UserID.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for SectionType +#include "lldb/lldb-forward.h" // for SectionSP, ModuleSP, SectionWP +#include "lldb/lldb-types.h" // for addr_t, offset_t, user_id_t + +#include <memory> // for enable_shared_from_this +#include <vector> // for vector + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, UINT32_MAX + +namespace lldb_private { +class Address; +} +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class ObjectFile; +} +namespace lldb_private { +class Section; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Target; +} namespace lldb_private { @@ -120,7 +143,8 @@ public: lldb::addr_t GetLoadBaseAddress(Target *target) const; - bool ResolveContainedAddress(lldb::addr_t offset, Address &so_addr) const; + bool ResolveContainedAddress(lldb::addr_t offset, Address &so_addr, + bool allow_section_end = false) const; lldb::offset_t GetFileOffset() const { return m_file_offset; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/SourceManager.h b/contrib/llvm/tools/lldb/include/lldb/Core/SourceManager.h index 9ca2a32..053badf 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/SourceManager.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/SourceManager.h @@ -10,20 +10,33 @@ #ifndef liblldb_SourceManager_h_ #define liblldb_SourceManager_h_ -// Project includes -#include "lldb/Host/FileSpec.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-forward.h" // for DebuggerSP, DebuggerWP, DataBufferSP -// Other libraries and framework includes #include "llvm/Support/Chrono.h" -// C Includes -// C++ Includes +#include <cstdint> // for uint32_t, UINT32_MAX #include <map> #include <memory> +#include <stddef.h> // for size_t +#include <string> // for string #include <vector> namespace lldb_private { +class RegularExpression; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class Target; +} + +namespace lldb_private { class SourceManager { public: diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/State.h b/contrib/llvm/tools/lldb/include/lldb/Core/State.h index a9d7692..68f0fee 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/State.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/State.h @@ -10,11 +10,13 @@ #ifndef liblldb_State_h_ #define liblldb_State_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" +#include "llvm/Support/FormatProviders.h" + +#include "lldb/lldb-enumerations.h" // for StateType +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/raw_ostream.h" // for raw_ostream + +#include <stdint.h> // for uint32_t namespace lldb_private { @@ -71,4 +73,13 @@ const char *GetPermissionsAsCString(uint32_t permissions); } // namespace lldb_private +namespace llvm { +template <> struct format_provider<lldb::StateType> { + static void format(const lldb::StateType &state, raw_ostream &Stream, + StringRef Style) { + Stream << lldb_private::StateAsCString(state); + } +}; +} + #endif // liblldb_State_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StreamAsynchronousIO.h b/contrib/llvm/tools/lldb/include/lldb/Core/StreamAsynchronousIO.h index b3bb49e..29b1097 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StreamAsynchronousIO.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/StreamAsynchronousIO.h @@ -1,5 +1,4 @@ -//===-- StreamAsynchronousIO.h -----------------------------------*- C++ -//-*-===// +//===-- StreamAsynchronousIO.h -----------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,9 +10,15 @@ #ifndef liblldb_StreamAsynchronousIO_h_ #define liblldb_StreamAsynchronousIO_h_ +#include "lldb/Utility/Stream.h" + #include <string> -#include "lldb/Core/Stream.h" +#include <stddef.h> // for size_t + +namespace lldb_private { +class Debugger; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StreamBuffer.h b/contrib/llvm/tools/lldb/include/lldb/Core/StreamBuffer.h index 4eef19f..3b18573 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StreamBuffer.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/StreamBuffer.h @@ -10,7 +10,7 @@ #ifndef liblldb_StreamBuffer_h_ #define liblldb_StreamBuffer_h_ -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" #include "llvm/ADT/SmallVector.h" #include <stdio.h> #include <string> diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StreamFile.h b/contrib/llvm/tools/lldb/include/lldb/Core/StreamFile.h index 8b86032..a26ae84 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StreamFile.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/StreamFile.h @@ -10,16 +10,13 @@ #ifndef liblldb_StreamFile_h_ #define liblldb_StreamFile_h_ -// C Includes -// C++ Includes - -#include <string> - -// Other libraries and framework includes -// Project includes - -#include "lldb/Core/Stream.h" #include "lldb/Host/File.h" +#include "lldb/Utility/Stream.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermission... + +#include <stdint.h> // for uint32_t +#include <stdio.h> // for size_t, FILE namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StructuredDataImpl.h b/contrib/llvm/tools/lldb/include/lldb/Core/StructuredDataImpl.h new file mode 100644 index 0000000..819d1d9 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Core/StructuredDataImpl.h @@ -0,0 +1,156 @@ +//===-- StructuredDataImpl.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_StructuredDataImpl_h_ +#define liblldb_StructuredDataImpl_h_ + +#include "lldb/Core/Event.h" +#include "lldb/Target/StructuredDataPlugin.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringRef.h" + +#pragma mark-- +#pragma mark StructuredDataImpl + +namespace lldb_private { + +class StructuredDataImpl { +public: + StructuredDataImpl() : m_plugin_wp(), m_data_sp() {} + + StructuredDataImpl(const StructuredDataImpl &rhs) = default; + + StructuredDataImpl(const lldb::EventSP &event_sp) + : m_plugin_wp( + EventDataStructuredData::GetPluginFromEvent(event_sp.get())), + m_data_sp(EventDataStructuredData::GetObjectFromEvent(event_sp.get())) { + } + + ~StructuredDataImpl() = default; + + StructuredDataImpl &operator=(const StructuredDataImpl &rhs) = default; + + bool IsValid() const { return m_data_sp.get() != nullptr; } + + void Clear() { + m_plugin_wp.reset(); + m_data_sp.reset(); + } + + Status GetAsJSON(Stream &stream) const { + Status error; + + if (!m_data_sp) { + error.SetErrorString("No structured data."); + return error; + } + + m_data_sp->Dump(stream); + return error; + } + + Status GetDescription(Stream &stream) const { + Status error; + + if (!m_data_sp) { + error.SetErrorString("Cannot pretty print structured data: " + "no data to print."); + return error; + } + + // Grab the plugin. + auto plugin_sp = lldb::StructuredDataPluginSP(m_plugin_wp); + if (!plugin_sp) { + error.SetErrorString("Cannot pretty print structured data: " + "plugin doesn't exist."); + return error; + } + + // Get the data's description. + return plugin_sp->GetDescription(m_data_sp, stream); + } + + StructuredData::ObjectSP GetObjectSP() { return m_data_sp; } + + void SetObjectSP(const StructuredData::ObjectSP &obj) { m_data_sp = obj; } + + lldb::StructuredDataType GetType() const { + return (m_data_sp ? m_data_sp->GetType() : + lldb::eStructuredDataTypeInvalid); + } + + size_t GetSize() const { + if (!m_data_sp) + return 0; + + if (m_data_sp->GetType() == lldb::eStructuredDataTypeDictionary) { + auto dict = m_data_sp->GetAsDictionary(); + return (dict->GetSize()); + } else if (m_data_sp->GetType() == lldb::eStructuredDataTypeArray) { + auto array = m_data_sp->GetAsArray(); + return (array->GetSize()); + } else + return 0; + } + + StructuredData::ObjectSP GetValueForKey(const char *key) const { + if (m_data_sp) { + auto dict = m_data_sp->GetAsDictionary(); + if (dict) + return dict->GetValueForKey(llvm::StringRef(key)); + } + return StructuredData::ObjectSP(); + } + + StructuredData::ObjectSP GetItemAtIndex(size_t idx) const { + if (m_data_sp) { + auto array = m_data_sp->GetAsArray(); + if (array) + return array->GetItemAtIndex(idx); + } + return StructuredData::ObjectSP(); + } + + uint64_t GetIntegerValue(uint64_t fail_value = 0) const { + return (m_data_sp ? m_data_sp->GetIntegerValue(fail_value) : fail_value); + } + + double GetFloatValue(double fail_value = 0.0) const { + return (m_data_sp ? m_data_sp->GetFloatValue(fail_value) : fail_value); + } + + bool GetBooleanValue(bool fail_value = false) const { + return (m_data_sp ? m_data_sp->GetBooleanValue(fail_value) : fail_value); + } + + size_t GetStringValue(char *dst, size_t dst_len) const { + if (!m_data_sp) + return 0; + + llvm::StringRef result = m_data_sp->GetStringValue(); + if (result.empty()) + return 0; + + if (!dst || !dst_len) { + char s[1]; + return (::snprintf(s, 1, "%s", result.data())); + } + return (::snprintf(dst, dst_len, "%s", result.data())); + } + +private: + lldb::StructuredDataPluginWP m_plugin_wp; + StructuredData::ObjectSP m_data_sp; +}; +} // namespace lldb_private +#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/UniqueCStringMap.h b/contrib/llvm/tools/lldb/include/lldb/Core/UniqueCStringMap.h index 77a350a..e8c6c7c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/UniqueCStringMap.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/UniqueCStringMap.h @@ -17,7 +17,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/RegularExpression.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/RegularExpression.h" namespace lldb_private { @@ -35,13 +36,17 @@ public: struct Entry { Entry() {} - Entry(llvm::StringRef cstr) : cstring(cstr), value() {} + Entry(ConstString cstr) : cstring(cstr), value() {} - Entry(llvm::StringRef cstr, const T &v) : cstring(cstr), value(v) {} + Entry(ConstString cstr, const T &v) : cstring(cstr), value(v) {} - bool operator<(const Entry &rhs) const { return cstring < rhs.cstring; } + // This is only for uniqueness, not lexicographical ordering, so we can + // just compare pointers. + bool operator<(const Entry &rhs) const { + return cstring.GetCString() < rhs.cstring.GetCString(); + } - llvm::StringRef cstring; + ConstString cstring; T value; }; @@ -50,7 +55,7 @@ public: // this map, then later call UniqueCStringMap<T>::Sort() before doing // any searches by name. //------------------------------------------------------------------ - void Append(llvm::StringRef unique_cstr, const T &value) { + void Append(ConstString unique_cstr, const T &value) { m_map.push_back(typename UniqueCStringMap<T>::Entry(unique_cstr, value)); } @@ -62,7 +67,7 @@ public: // Call this function to always keep the map sorted when putting // entries into the map. //------------------------------------------------------------------ - void Insert(llvm::StringRef unique_cstr, const T &value) { + void Insert(ConstString unique_cstr, const T &value) { typename UniqueCStringMap<T>::Entry e(unique_cstr, value); m_map.insert(std::upper_bound(m_map.begin(), m_map.end(), e), e); } @@ -85,7 +90,7 @@ public: return false; } - llvm::StringRef GetCStringAtIndexUnchecked(uint32_t idx) const { + ConstString GetCStringAtIndexUnchecked(uint32_t idx) const { return m_map[idx].cstring; } @@ -99,8 +104,8 @@ public: return m_map[idx].value; } - llvm::StringRef GetCStringAtIndex(uint32_t idx) const { - return ((idx < m_map.size()) ? m_map[idx].cstring : llvm::StringRef()); + ConstString GetCStringAtIndex(uint32_t idx) const { + return ((idx < m_map.size()) ? m_map[idx].cstring : ConstString()); } //------------------------------------------------------------------ @@ -111,7 +116,7 @@ public: // T values and only if there is a sensible failure value that can // be returned and that won't match any existing values. //------------------------------------------------------------------ - T Find(llvm::StringRef unique_cstr, T fail_value) const { + T Find(ConstString unique_cstr, T fail_value) const { Entry search_entry(unique_cstr); const_iterator end = m_map.end(); const_iterator pos = std::lower_bound(m_map.begin(), end, search_entry); @@ -129,15 +134,12 @@ public: // The caller is responsible for ensuring that the collection does // not change during while using the returned pointer. //------------------------------------------------------------------ - const Entry *FindFirstValueForName(llvm::StringRef unique_cstr) const { + const Entry *FindFirstValueForName(ConstString unique_cstr) const { Entry search_entry(unique_cstr); const_iterator end = m_map.end(); const_iterator pos = std::lower_bound(m_map.begin(), end, search_entry); - if (pos != end) { - llvm::StringRef pos_cstr = pos->cstring; - if (pos_cstr == unique_cstr) - return &(*pos); - } + if (pos != end && pos->cstring == unique_cstr) + return &(*pos); return nullptr; } @@ -162,7 +164,7 @@ public: return nullptr; } - size_t GetValues(llvm::StringRef unique_cstr, std::vector<T> &values) const { + size_t GetValues(ConstString unique_cstr, std::vector<T> &values) const { const size_t start_size = values.size(); Entry search_entry(unique_cstr); @@ -184,7 +186,7 @@ public: const_iterator pos, end = m_map.end(); for (pos = m_map.begin(); pos != end; ++pos) { - if (regex.Execute(pos->cstring)) + if (regex.Execute(pos->cstring.GetCString())) values.push_back(pos->value); } @@ -238,7 +240,7 @@ public: } } - size_t Erase(llvm::StringRef unique_cstr) { + size_t Erase(ConstString unique_cstr) { size_t num_removed = 0; Entry search_entry(unique_cstr); iterator end = m_map.end(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/UserSettingsController.h b/contrib/llvm/tools/lldb/include/lldb/Core/UserSettingsController.h index a30dfd4..67bc9b2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/UserSettingsController.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/UserSettingsController.h @@ -10,21 +10,32 @@ #ifndef liblldb_UserSettingsController_h_ #define liblldb_UserSettingsController_h_ -// C Includes -// C++ Includes +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-forward.h" // for OptionValuePropertiesSP +#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType + +#include "llvm/ADT/StringRef.h" // for StringRef -#include <string> #include <vector> -// Other libraries and framework includes -// Project includes +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/StringList.h" -#include "lldb/Interpreter/OptionValue.h" -#include "lldb/lldb-private.h" +namespace lldb_private { +class CommandInterpreter; +} +namespace lldb_private { +class ConstString; +} +namespace lldb_private { +class ExecutionContext; +} +namespace lldb_private { +class Property; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { @@ -46,15 +57,16 @@ public: virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx, llvm::StringRef property_path, bool will_modify, - Error &error) const; + Status &error) const; - virtual Error SetPropertyValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, - llvm::StringRef property_path, llvm::StringRef value); + virtual Status SetPropertyValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, + llvm::StringRef property_path, + llvm::StringRef value); - virtual Error DumpPropertyValue(const ExecutionContext *exe_ctx, Stream &strm, - llvm::StringRef property_path, - uint32_t dump_mask); + virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx, + Stream &strm, llvm::StringRef property_path, + uint32_t dump_mask); virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Value.h b/contrib/llvm/tools/lldb/include/lldb/Core/Value.h index 2800c4f..678b56f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Value.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/Value.h @@ -10,17 +10,39 @@ #ifndef liblldb_Value_h_ #define liblldb_Value_h_ -// C Includes -// C++ Includes -#include <vector> - -// Other libraries and framework includes -// Project includes -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Scalar.h" #include "lldb/Symbol/CompilerType.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/Status.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder, ByteOrder::eB... +#include "lldb/lldb-private-enumerations.h" // for AddressType +#include "lldb/lldb-private-types.h" // for type128, RegisterInfo + +#include "llvm/ADT/APInt.h" // for APInt + +#include <vector> + +#include <stdint.h> // for uint8_t, uint32_t, uint64_t +#include <string.h> // for size_t, memcpy + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class ExecutionContext; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class Type; +} +namespace lldb_private { +class Variable; +} namespace lldb_private { @@ -197,11 +219,11 @@ public: lldb::Format GetValueDefaultFormat(); - uint64_t GetValueByteSize(Error *error_ptr, ExecutionContext *exe_ctx); + uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx); - Error GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, - uint32_t data_offset, - Module *module); // Can be nullptr + Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data, + uint32_t data_offset, + Module *module); // Can be nullptr static const char *GetValueTypeAsCString(ValueType context_type); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObject.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObject.h index 84b187e..fa1d148 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObject.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObject.h @@ -10,32 +10,67 @@ #ifndef liblldb_ValueObject_h_ #define liblldb_ValueObject_h_ -// C Includes -// C++ Includes -#include <functional> -#include <initializer_list> -#include <map> -#include <vector> - -// Other libraries and framework includes -#include "llvm/ADT/Optional.h" -#include "llvm/ADT/SmallVector.h" - -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Flags.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/Value.h" +#include "lldb/DataFormatters/DumpValueObjectOptions.h" // for DumpValueObj... #include "lldb/Symbol/CompilerType.h" +#include "lldb/Symbol/Type.h" // for TypeImpl #include "lldb/Target/ExecutionContext.h" -#include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/Process.h" -#include "lldb/Target/StackID.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/DataExtractor.h" #include "lldb/Utility/SharedCluster.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/UserID.h" +#include "lldb/lldb-defines.h" // for LLDB_INVALID... +#include "lldb/lldb-enumerations.h" // for DynamicValue... +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-private-enumerations.h" // for AddressType +#include "lldb/lldb-types.h" // for addr_t, offs... + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/Optional.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <functional> +#include <initializer_list> +#include <map> +#include <mutex> // for recursive_mutex +#include <string> // for string +#include <utility> // for pair +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t +namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class EvaluateExpressionOptions; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Scalar; +} +namespace lldb_private { +class Stream; +} +namespace lldb_private { +class SymbolContextScope; +} +namespace lldb_private { +class TypeFormatImpl; +} +namespace lldb_private { +class TypeSummaryImpl; +} +namespace lldb_private { +class TypeSummaryOptions; +} namespace lldb_private { /// ValueObject: @@ -427,7 +462,7 @@ public: virtual int64_t GetValueAsSigned(int64_t fail_value, bool *success = nullptr); - virtual bool SetValueFromCString(const char *value_str, Error &error); + virtual bool SetValueFromCString(const char *value_str, Status &error); // Return the module associated with this value object in case the // value is from an executable file and might have its data in @@ -447,42 +482,26 @@ public: //------------------------------------------------------------------ // The functions below should NOT be modified by subclasses //------------------------------------------------------------------ - const Error &GetError(); + const Status &GetError(); const ConstString &GetName() const; virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create); // this will always create the children if necessary - lldb::ValueObjectSP - GetChildAtIndexPath(const std::initializer_list<size_t> &idxs, - size_t *index_of_error = nullptr); - - lldb::ValueObjectSP GetChildAtIndexPath(const std::vector<size_t> &idxs, + lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs, size_t *index_of_error = nullptr); - lldb::ValueObjectSP GetChildAtIndexPath( - const std::initializer_list<std::pair<size_t, bool>> &idxs, - size_t *index_of_error = nullptr); - lldb::ValueObjectSP - GetChildAtIndexPath(const std::vector<std::pair<size_t, bool>> &idxs, + GetChildAtIndexPath(llvm::ArrayRef<std::pair<size_t, bool>> idxs, size_t *index_of_error = nullptr); // this will always create the children if necessary - lldb::ValueObjectSP - GetChildAtNamePath(const std::initializer_list<ConstString> &names, - ConstString *name_of_error = nullptr); - - lldb::ValueObjectSP GetChildAtNamePath(const std::vector<ConstString> &names, + lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef<ConstString> names, ConstString *name_of_error = nullptr); - lldb::ValueObjectSP GetChildAtNamePath( - const std::initializer_list<std::pair<ConstString, bool>> &names, - ConstString *name_of_error = nullptr); - lldb::ValueObjectSP - GetChildAtNamePath(const std::vector<std::pair<ConstString, bool>> &names, + GetChildAtNamePath(llvm::ArrayRef<std::pair<ConstString, bool>> names, ConstString *name_of_error = nullptr); virtual lldb::ValueObjectSP GetChildMemberWithName(const ConstString &name, @@ -501,7 +520,7 @@ public: // return 'false' whenever you set the error, otherwise // callers may assume true means everything is OK - this will // break breakpoint conditions among potentially a few others - virtual bool IsLogicalTrue(Error &error); + virtual bool IsLogicalTrue(Status &error); virtual const char *GetLocationAsCString(); @@ -552,6 +571,9 @@ public: lldb::ValueObjectSP GetSP() { return m_manager->GetSharedPointer(this); } + // Change the name of the current ValueObject. Should *not* be used from a + // synthetic child provider as it would change the name of the non synthetic + // child as well. void SetName(const ConstString &name); virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, @@ -598,9 +620,15 @@ public: virtual lldb::ValueObjectSP CreateConstantValue(const ConstString &name); - virtual lldb::ValueObjectSP Dereference(Error &error); + virtual lldb::ValueObjectSP Dereference(Status &error); + + // Creates a copy of the ValueObject with a new name and setting the current + // ValueObject as its parent. It should be used when we want to change the + // name of a ValueObject without modifying the actual ValueObject itself + // (e.g. sythetic child provider). + virtual lldb::ValueObjectSP Clone(const ConstString &new_name); - virtual lldb::ValueObjectSP AddressOf(Error &error); + virtual lldb::ValueObjectSP AddressOf(Status &error); virtual lldb::addr_t GetLiveAddress() { return LLDB_INVALID_ADDRESS; } @@ -672,16 +700,16 @@ public: bool IsCStringContainer(bool check_pointer = false); std::pair<size_t, bool> - ReadPointedString(lldb::DataBufferSP &buffer_sp, Error &error, + ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error, uint32_t max_length = 0, bool honor_array = true, lldb::Format item_format = lldb::eFormatCharArray); virtual size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1); - virtual uint64_t GetData(DataExtractor &data, Error &error); + virtual uint64_t GetData(DataExtractor &data, Status &error); - virtual bool SetData(DataExtractor &data, Error &error); + virtual bool SetData(DataExtractor &data, Status &error); virtual bool GetIsConstant() const { return m_update_point.IsConstant(); } @@ -852,8 +880,9 @@ protected: DataExtractor m_data; // A data extractor that can be used to extract the value. Value m_value; - Error m_error; // An error object that can describe any errors that occur when - // updating values. + Status + m_error; // An error object that can describe any errors that occur when + // updating values. std::string m_value_str; // Cached value string that will get cleared if/when // the value is updated. std::string m_old_value_str; // Cached old value string from the last time the diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectCast.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectCast.h index 50959b9..aaa1ecb 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectCast.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectCast.h @@ -10,11 +10,18 @@ #ifndef liblldb_ValueObjectCast_h_ #define liblldb_ValueObjectCast_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-forward.h" // for ValueObjectSP + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class ConstString; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectChild.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectChild.h index b84cb3d..ec8c9e8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectChild.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectChild.h @@ -10,14 +10,20 @@ #ifndef liblldb_ValueObjectChild_h_ #define liblldb_ValueObjectChild_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-private-enumerations.h" // for LazyBool, AddressType +#include "lldb/lldb-types.h" // for offset_t + #include "llvm/ADT/Optional.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int32_t + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResult.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResult.h index 994ac47..1f56129 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResult.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResult.h @@ -10,15 +10,31 @@ #ifndef liblldb_ValueObjectConstResult_h_ #define liblldb_ValueObjectConstResult_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/Core/Value.h" // for Value #include "lldb/Core/ValueObject.h" - #include "lldb/Core/ValueObjectConstResultImpl.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-enumerations.h" // for ByteOrder, Dynamic... +#include "lldb/lldb-forward.h" // for ValueObjectSP, Dat... +#include "lldb/lldb-private-enumerations.h" // for AddressType, Addre... +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Module; +} +namespace lldb_private { //---------------------------------------------------------------------- // A frozen ValueObject copied into host memory @@ -53,7 +69,7 @@ public: // When an expression fails to evaluate, we return an error static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, - const Error &error); + const Status &error); uint64_t GetByteSize() override; @@ -69,7 +85,7 @@ public: void SetByteSize(size_t size); - lldb::ValueObjectSP Dereference(Error &error) override; + lldb::ValueObjectSP Dereference(Status &error) override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -78,7 +94,7 @@ public: uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Error &error) override; + lldb::ValueObjectSP AddressOf(Status &error) override; lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, AddressType *address_type = nullptr) override; @@ -137,7 +153,7 @@ private: ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value, const ConstString &name, Module *module = nullptr); - ValueObjectConstResult(ExecutionContextScope *exe_scope, const Error &error); + ValueObjectConstResult(ExecutionContextScope *exe_scope, const Status &error); DISALLOW_COPY_AND_ASSIGN(ValueObjectConstResult); }; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultCast.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultCast.h index 4b2a3e2..442cce4 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultCast.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultCast.h @@ -10,12 +10,26 @@ #ifndef liblldb_ValueObjectConstResultCast_h_ #define liblldb_ValueObjectConstResultCast_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObjectCast.h" #include "lldb/Core/ValueObjectConstResultImpl.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_... +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int32_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Status; +} +namespace lldb_private { +class ValueObject; +} namespace lldb_private { @@ -27,7 +41,7 @@ public: ~ValueObjectConstResultCast() override; - lldb::ValueObjectSP Dereference(Error &error) override; + lldb::ValueObjectSP Dereference(Status &error) override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -40,7 +54,7 @@ public: uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Error &error) override; + lldb::ValueObjectSP AddressOf(Status &error) override; size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultChild.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultChild.h index 66127b9..a74da00 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultChild.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultChild.h @@ -1,5 +1,4 @@ -//===-- ValueObjectConstResultChild.h -------------------------------*- C++ -//-*-===// +//===-- ValueObjectConstResultChild.h ----------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,12 +10,25 @@ #ifndef liblldb_ValueObjectConstResultChild_h_ #define liblldb_ValueObjectConstResultChild_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObjectChild.h" #include "lldb/Core/ValueObjectConstResultImpl.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_... +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int32_t +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Status; +} +namespace lldb_private { +class ValueObject; +} namespace lldb_private { @@ -36,7 +48,7 @@ public: ~ValueObjectConstResultChild() override; - lldb::ValueObjectSP Dereference(Error &error) override; + lldb::ValueObjectSP Dereference(Status &error) override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -49,7 +61,7 @@ public: uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Error &error) override; + lldb::ValueObjectSP AddressOf(Status &error) override; size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultImpl.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultImpl.h index c26bf41..d86f25e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultImpl.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectConstResultImpl.h @@ -10,11 +10,26 @@ #ifndef liblldb_ValueObjectConstResultImpl_h_ #define liblldb_ValueObjectConstResultImpl_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ValueObject.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-private-enumerations.h" // for AddressType, AddressType... +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, int32_t +namespace lldb_private { +class CompilerType; +} +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Status; +} +namespace lldb_private { +class ValueObject; +} namespace lldb_private { @@ -30,7 +45,7 @@ public: virtual ~ValueObjectConstResultImpl() = default; - lldb::ValueObjectSP Dereference(Error &error); + lldb::ValueObjectSP Dereference(Status &error); ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index); @@ -40,7 +55,7 @@ public: bool can_create, ConstString name_const_str = ConstString()); - lldb::ValueObjectSP AddressOf(Error &error); + lldb::ValueObjectSP AddressOf(Status &error); lldb::addr_t GetLiveAddress() { return m_live_address; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectDynamicValue.h index e58e74f..018ee2c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectDynamicValue.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectDynamicValue.h @@ -10,13 +10,30 @@ #ifndef liblldb_ValueObjectDynamicValue_h_ #define liblldb_ValueObjectDynamicValue_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType #include "lldb/Symbol/Type.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/Utility/SharingPtr.h" // for operator== +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for DynamicValueType, Langua... +#include "lldb/lldb-forward.h" // for ValueObjectSP, VariableSP +#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz... +#include <assert.h> // for assert +#include <stddef.h> // for size_t +#include <stdint.h> // for uint64_t, uint32_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class Status; +} namespace lldb_private { //---------------------------------------------------------------------- @@ -69,9 +86,9 @@ public: m_owning_valobj_sp = owning_sp; } - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; - bool SetData(DataExtractor &data, Error &error) override; + bool SetData(DataExtractor &data, Status &error) override; TypeImpl GetTypeImpl() override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectList.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectList.h index c5427c6..a0d2e68 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectList.h @@ -10,15 +10,16 @@ #ifndef liblldb_ValueObjectList_h_ #define liblldb_ValueObjectList_h_ -// C Includes -// C++ Includes +#include "lldb/lldb-forward.h" // for ValueObjectSP +#include "lldb/lldb-types.h" // for user_id_t + #include <vector> -// Other libraries and framework includes -// Project includes -#include "lldb/Core/UserID.h" -#include "lldb/Target/ExecutionContextScope.h" -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t + +namespace lldb_private { +class ValueObject; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectMemory.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectMemory.h index f9891c4..8bb649c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectMemory.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectMemory.h @@ -10,12 +10,21 @@ #ifndef liblldb_ValueObjectMemory_h_ #define liblldb_ValueObjectMemory_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/Core/Address.h" // for Address #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-forward.h" // for TypeSP, ValueObjectSP, ModuleSP +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class ExecutionContextScope; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectRegister.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectRegister.h index 11d2054..2aaef9b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectRegister.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectRegister.h @@ -10,13 +10,33 @@ #ifndef liblldb_ValueObjectRegister_h_ #define liblldb_ValueObjectRegister_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/RegisterValue.h" #include "lldb/Core/ValueObject.h" -#include "lldb/lldb-private.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType, ValueType::eValueTy... +#include "lldb/lldb-forward.h" // for RegisterContextSP, ValueObjectSP +#include "lldb/lldb-private-types.h" // for RegisterInfo, RegisterSet (ptr... + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, int32_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Status; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class Scalar; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { @@ -128,9 +148,9 @@ public: size_t CalculateNumChildren(uint32_t max) override; - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; - bool SetData(DataExtractor &data, Error &error) override; + bool SetData(DataExtractor &data, Status &error) override; bool ResolveValue(Scalar &scalar) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h index 0a5a4d9..e32e140 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -10,17 +10,31 @@ #ifndef liblldb_ValueObjectSyntheticFilter_h_ #define liblldb_ValueObjectSyntheticFilter_h_ -// C Includes -// C++ Includes -#include <memory> - -// Other libraries and framework includes -// Project includes #include "lldb/Core/ThreadSafeSTLMap.h" #include "lldb/Core/ThreadSafeSTLVector.h" #include "lldb/Core/ValueObject.h" +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for ThreadSafeSTLMap::operator= +#include "lldb/lldb-enumerations.h" // for DynamicValueType, Langua... +#include "lldb/lldb-forward.h" // for ValueObjectSP, Synthetic... +#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz... + +#include <cstdint> // for uint32_t, uint64_t +#include <memory> + +#include <stddef.h> // for size_t namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class Status; +} +namespace lldb_private { +class SyntheticChildrenFrontEnd; +} +namespace lldb_private { //---------------------------------------------------------------------- // A ValueObject that obtains its children from some source other than @@ -96,7 +110,7 @@ public: bool GetIsConstant() const override { return false; } - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; void SetFormat(lldb::Format format) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectVariable.h b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectVariable.h index b76c48a..9dd140a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectVariable.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectVariable.h @@ -10,12 +10,34 @@ #ifndef liblldb_ValueObjectVariable_h_ #define liblldb_ValueObjectVariable_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Core/ValueObject.h" +#include "lldb/Core/Value.h" // for Value +#include "lldb/Symbol/CompilerType.h" // for CompilerType +#include "lldb/Utility/ConstString.h" // for ConstString +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ValueType +#include "lldb/lldb-forward.h" // for VariableSP, ModuleSP, ValueObj... + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class DataExtractor; +} +namespace lldb_private { +class Declaration; +} +namespace lldb_private { +class Status; +} +namespace lldb_private { +class ExecutionContextScope; +} +namespace lldb_private { +class SymbolContextScope; +} + namespace lldb_private { //---------------------------------------------------------------------- @@ -51,9 +73,9 @@ public: const char *GetLocationAsCString() override; - bool SetValueFromCString(const char *value_str, Error &error) override; + bool SetValueFromCString(const char *value_str, Status &error) override; - bool SetData(DataExtractor &data, Error &error) override; + bool SetData(DataExtractor &data, Status &error) override; virtual lldb::VariableSP GetVariable() override { return m_variable_sp; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/dwarf.h b/contrib/llvm/tools/lldb/include/lldb/Core/dwarf.h index 4a935d5..651a2bc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/dwarf.h +++ b/contrib/llvm/tools/lldb/include/lldb/Core/dwarf.h @@ -13,7 +13,7 @@ #include <stdint.h> // Get the DWARF constant definitions from llvm -#include "llvm/Support/Dwarf.h" +#include "llvm/BinaryFormat/Dwarf.h" #include "lldb/Core/RangeMap.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DataVisualization.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DataVisualization.h index 7a632d6..343099b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DataVisualization.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DataVisualization.h @@ -15,9 +15,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/DataFormatters/FormatClasses.h" #include "lldb/DataFormatters/FormatManager.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h index b510a3c..00baea7 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h @@ -27,7 +27,7 @@ namespace lldb_private { class DumpValueObjectOptions { public: struct PointerDepth { - enum class Mode { Always, Formatters, Default, Never } m_mode; + enum class Mode { Always, Default, Never } m_mode; uint32_t m_count; PointerDepth operator--() const { @@ -37,9 +37,6 @@ public: } bool CanAllowExpansion() const; - - bool CanAllowExpansion(bool is_root, TypeSummaryImpl *entry, - ValueObject *valobj, const std::string &summary); }; struct PointerAsArraySettings { diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormatCache.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormatCache.h index ab369a1..9901ec9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormatCache.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormatCache.h @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormattersContainer.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormattersContainer.h index e432099..2df5bf4 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormattersContainer.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/FormattersContainer.h @@ -22,7 +22,6 @@ // Project includes #include "lldb/lldb-public.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/ValueObject.h" #include "lldb/DataFormatters/FormatClasses.h" #include "lldb/DataFormatters/TypeFormat.h" @@ -30,6 +29,7 @@ #include "lldb/DataFormatters/TypeSynthetic.h" #include "lldb/DataFormatters/TypeValidator.h" #include "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/StringLexer.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/StringPrinter.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/StringPrinter.h index 4332946..8d4a099 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/StringPrinter.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/StringPrinter.h @@ -19,7 +19,7 @@ // Project includes #include "lldb/lldb-forward.h" -#include "lldb/Core/DataExtractor.h" +#include "lldb/Utility/DataExtractor.h" namespace lldb_private { namespace formatters { diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSummary.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSummary.h index 7b2feeb..1bde565 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSummary.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSummary.h @@ -23,9 +23,9 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" -#include "lldb/Core/Error.h" #include "lldb/Core/FormatEntity.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StructuredData.h" namespace lldb_private { class TypeSummaryOptions { @@ -286,7 +286,7 @@ private: struct StringSummaryFormat : public TypeSummaryImpl { std::string m_format_str; FormatEntity::Entry m_format; - Error m_error; + Status m_error; StringSummaryFormat(const TypeSummaryImpl::Flags &flags, const char *f); diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSynthetic.h index 6f5a8df..59fb6d3 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -25,8 +25,8 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Core/ValueObject.h" +#include "lldb/Utility/StructuredData.h" namespace lldb_private { class SyntheticChildrenFrontEnd { diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h index f0d09ac..4185143 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h @@ -19,7 +19,8 @@ #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/DataFormatters/DumpValueObjectOptions.h" #include "lldb/Symbol/CompilerType.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/VectorIterator.h b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/VectorIterator.h index 38bcfe9..fcf5aba 100644 --- a/contrib/llvm/tools/lldb/include/lldb/DataFormatters/VectorIterator.h +++ b/contrib/llvm/tools/lldb/include/lldb/DataFormatters/VectorIterator.h @@ -13,8 +13,8 @@ #include "lldb/lldb-forward.h" -#include "lldb/Core/ConstString.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { namespace formatters { diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/DWARFExpression.h b/contrib/llvm/tools/lldb/include/lldb/Expression/DWARFExpression.h index ea3f5cc..1816c3b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/DWARFExpression.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/DWARFExpression.h @@ -11,10 +11,10 @@ #define liblldb_DWARFExpression_h_ #include "lldb/Core/Address.h" -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/Disassembler.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Scalar.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include <functional> @@ -266,7 +266,7 @@ public: ClangExpressionDeclMap *decl_map, lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, - Value &result, Error *error_ptr) const; + Value &result, Status *error_ptr) const; //------------------------------------------------------------------ /// Wrapper for the static evaluate function that uses member @@ -277,7 +277,7 @@ public: ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx, lldb::addr_t loclist_base_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, - Value &result, Error *error_ptr) const; + Value &result, Status *error_ptr) const; //------------------------------------------------------------------ /// Evaluate a DWARF location expression in a particular context @@ -345,7 +345,7 @@ public: 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, Error *error_ptr); + Value &result, Status *error_ptr); //------------------------------------------------------------------ /// Loads a ClangExpressionVariableList into the object diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/DiagnosticManager.h b/contrib/llvm/tools/lldb/include/lldb/Expression/DiagnosticManager.h index d9024e6..83e67df 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/DiagnosticManager.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/DiagnosticManager.h @@ -128,6 +128,8 @@ public: m_diagnostics.push_back(diagnostic); } + void CopyDiagnostics(DiagnosticManager &otherDiagnostics); + size_t Printf(DiagnosticSeverity severity, const char *format, ...) __attribute__((format(printf, 3, 4))); size_t PutString(DiagnosticSeverity severity, llvm::StringRef str); diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/Expression.h b/contrib/llvm/tools/lldb/include/lldb/Expression/Expression.h index f48a799..860444e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/Expression.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/Expression.h @@ -99,6 +99,16 @@ public: //------------------------------------------------------------------ lldb::addr_t StartAddress() { return m_jit_start_addr; } + //------------------------------------------------------------------ + /// Called to notify the expression that it is about to be executed. + //------------------------------------------------------------------ + virtual void WillStartExecuting() {} + + //------------------------------------------------------------------ + /// Called to notify the expression that its execution has finished. + //------------------------------------------------------------------ + virtual void DidFinishExecuting() {} + virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; } protected: diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionParser.h b/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionParser.h index 99f583d..19526d2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionParser.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionParser.h @@ -10,7 +10,7 @@ #ifndef liblldb_ExpressionParser_h_ #define liblldb_ExpressionParser_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" namespace lldb_private { @@ -108,7 +108,7 @@ public: /// An error code indicating the success or failure of the operation. /// Test with Success(). //------------------------------------------------------------------ - virtual Error + virtual Status PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end, std::shared_ptr<IRExecutionUnit> &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionVariable.h b/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionVariable.h index 3f6b020..c757093 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionVariable.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionVariable.h @@ -19,8 +19,8 @@ #include "llvm/ADT/DenseMap.h" // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Core/ValueObject.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h b/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h index 72c1775..b0b4d7a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/IRExecutionUnit.h @@ -22,10 +22,10 @@ #include "llvm/IR/Module.h" // Project includes -#include "lldb/Core/DataBufferHeap.h" #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Utility/DataBufferHeap.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" @@ -39,7 +39,7 @@ class ObjectCache; namespace lldb_private { -class Error; +class Status; //---------------------------------------------------------------------- /// @class IRExecutionUnit IRExecutionUnit.h "lldb/Expression/IRExecutionUnit.h" @@ -86,7 +86,7 @@ public: : nullptr); } - void GetRunnableInfo(Error &error, lldb::addr_t &func_addr, + void GetRunnableInfo(Status &error, lldb::addr_t &func_addr, lldb::addr_t &func_end); //------------------------------------------------------------------ @@ -95,7 +95,7 @@ public: /// IRExecutionUnit unless the client explicitly chooses to free it. //------------------------------------------------------------------ - lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Error &error); + lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Status &error); void FreeNow(lldb::addr_t allocation); @@ -240,7 +240,7 @@ private: //------------------------------------------------------------------ bool WriteData(lldb::ProcessSP &process_sp); - Error DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp); + Status DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp); struct SearchSpec; @@ -391,7 +391,7 @@ private: void dump(Log *log); }; - bool CommitOneAllocation(lldb::ProcessSP &process_sp, Error &error, + bool CommitOneAllocation(lldb::ProcessSP &process_sp, Status &error, AllocationRecord &record); typedef std::vector<AllocationRecord> RecordVector; diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/IRInterpreter.h b/contrib/llvm/tools/lldb/include/lldb/Expression/IRInterpreter.h index b821e67..36e03c6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/IRInterpreter.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/IRInterpreter.h @@ -10,8 +10,8 @@ #ifndef liblldb_IRInterpreter_h_ #define liblldb_IRInterpreter_h_ -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Stream.h" #include "lldb/lldb-public.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/Pass.h" @@ -39,20 +39,20 @@ class IRMemoryMap; class IRInterpreter { public: static bool CanInterpret(llvm::Module &module, llvm::Function &function, - lldb_private::Error &error, + lldb_private::Status &error, const bool support_function_calls); static bool Interpret(llvm::Module &module, llvm::Function &function, llvm::ArrayRef<lldb::addr_t> args, lldb_private::IRExecutionUnit &execution_unit, - lldb_private::Error &error, + lldb_private::Status &error, lldb::addr_t stack_frame_bottom, lldb::addr_t stack_frame_top, lldb_private::ExecutionContext &exe_ctx); private: static bool supportsFunction(llvm::Function &llvm_function, - lldb_private::Error &err); + lldb_private::Status &err); }; #endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/IRMemoryMap.h b/contrib/llvm/tools/lldb/include/lldb/Expression/IRMemoryMap.h index 405de51..abb5cd7 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/IRMemoryMap.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/IRMemoryMap.h @@ -10,8 +10,8 @@ #ifndef lldb_IRMemoryMap_h_ #define lldb_IRMemoryMap_h_ -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/UserID.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-public.h" #include <map> @@ -54,25 +54,25 @@ public: }; lldb::addr_t Malloc(size_t size, uint8_t alignment, uint32_t permissions, - AllocationPolicy policy, bool zero_memory, Error &error); - void Leak(lldb::addr_t process_address, Error &error); - void Free(lldb::addr_t process_address, Error &error); + AllocationPolicy policy, bool zero_memory, Status &error); + void Leak(lldb::addr_t process_address, Status &error); + void Free(lldb::addr_t process_address, Status &error); void WriteMemory(lldb::addr_t process_address, const uint8_t *bytes, - size_t size, Error &error); + size_t size, Status &error); void WriteScalarToMemory(lldb::addr_t process_address, Scalar &scalar, - size_t size, Error &error); + size_t size, Status &error); void WritePointerToMemory(lldb::addr_t process_address, lldb::addr_t address, - Error &error); + Status &error); void ReadMemory(uint8_t *bytes, lldb::addr_t process_address, size_t size, - Error &error); + Status &error); void ReadScalarFromMemory(Scalar &scalar, lldb::addr_t process_address, - size_t size, Error &error); + size_t size, Status &error); void ReadPointerFromMemory(lldb::addr_t *address, - lldb::addr_t process_address, Error &error); + lldb::addr_t process_address, Status &error); bool GetAllocSize(lldb::addr_t address, size_t &size); void GetMemoryData(DataExtractor &extractor, lldb::addr_t process_address, - size_t size, Error &error); + size_t size, Status &error); lldb::ByteOrder GetByteOrder(); uint32_t GetAddressByteSize(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/LLVMUserExpression.h b/contrib/llvm/tools/lldb/include/lldb/Expression/LLVMUserExpression.h index 48d0161..745d413 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/LLVMUserExpression.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/LLVMUserExpression.h @@ -81,7 +81,7 @@ protected: lldb::ExpressionVariableSP &result) override; virtual void ScanContext(ExecutionContext &exe_ctx, - lldb_private::Error &err) = 0; + lldb_private::Status &err) = 0; bool PrepareToExecuteJITExpression(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx, diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/Materializer.h b/contrib/llvm/tools/lldb/include/lldb/Expression/Materializer.h index 4874929..b86bc65 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/Materializer.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/Materializer.h @@ -17,10 +17,10 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/Expression/IRMemoryMap.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/StackFrame.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-types.h" namespace lldb_private { @@ -38,7 +38,7 @@ public: ~Dematerializer() { Wipe(); } - void Dematerialize(Error &err, lldb::addr_t frame_top, + void Dematerialize(Status &err, lldb::addr_t frame_top, lldb::addr_t frame_bottom); void Wipe(); @@ -72,7 +72,7 @@ public: typedef std::weak_ptr<Dematerializer> DematerializerWP; DematerializerSP Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err); + lldb::addr_t process_address, Status &err); class PersistentVariableDelegate { public: @@ -83,13 +83,13 @@ public: uint32_t AddPersistentVariable(lldb::ExpressionVariableSP &persistent_variable_sp, - PersistentVariableDelegate *delegate, Error &err); - uint32_t AddVariable(lldb::VariableSP &variable_sp, Error &err); + PersistentVariableDelegate *delegate, Status &err); + uint32_t AddVariable(lldb::VariableSP &variable_sp, Status &err); uint32_t AddResultVariable(const CompilerType &type, bool is_lvalue, bool keep_in_memory, - PersistentVariableDelegate *delegate, Error &err); - uint32_t AddSymbol(const Symbol &symbol_sp, Error &err); - uint32_t AddRegister(const RegisterInfo ®ister_info, Error &err); + PersistentVariableDelegate *delegate, Status &err); + uint32_t AddSymbol(const Symbol &symbol_sp, Status &err); + uint32_t AddRegister(const RegisterInfo ®ister_info, Status &err); uint32_t GetStructAlignment() { return m_struct_alignment; } @@ -102,11 +102,11 @@ public: virtual ~Entity() = default; virtual void Materialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, - lldb::addr_t process_address, Error &err) = 0; + lldb::addr_t process_address, Status &err) = 0; virtual void Dematerialize(lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, - lldb::addr_t frame_bottom, Error &err) = 0; + lldb::addr_t frame_bottom, Status &err) = 0; virtual void DumpToLog(IRMemoryMap &map, lldb::addr_t process_address, Log *log) = 0; virtual void Wipe(IRMemoryMap &map, lldb::addr_t process_address) = 0; diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/REPL.h b/contrib/llvm/tools/lldb/include/lldb/Expression/REPL.h index 56d31cf..0c1e97f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/REPL.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/REPL.h @@ -60,7 +60,7 @@ public: /// @return /// The range of the containing object in the target process. //------------------------------------------------------------------ - static lldb::REPLSP Create(Error &Error, lldb::LanguageType language, + static lldb::REPLSP Create(Status &Status, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options); @@ -85,7 +85,7 @@ public: lldb::IOHandlerSP GetIOHandler(); - Error RunLoop(); + Status RunLoop(); //------------------------------------------------------------------ // IOHandler::Delegate functions @@ -126,7 +126,7 @@ protected: // Subclasses should override these functions to implement a functional REPL. //---------------------------------------------------------------------- - virtual Error DoInitialization() = 0; + virtual Status DoInitialization() = 0; virtual ConstString GetSourceFileBasename() = 0; diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/UserExpression.h b/contrib/llvm/tools/lldb/include/lldb/Expression/UserExpression.h index fca667e..ced5cb2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/UserExpression.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/UserExpression.h @@ -259,13 +259,13 @@ public: static lldb::ExpressionResults Evaluate(ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options, llvm::StringRef expr_cstr, llvm::StringRef expr_prefix, - lldb::ValueObjectSP &result_valobj_sp, Error &error, + lldb::ValueObjectSP &result_valobj_sp, Status &error, uint32_t line_offset = 0, std::string *fixed_expression = nullptr, lldb::ModuleSP *jit_module_sp_ptr = nullptr); - static const Error::ValueType kNoResult = + static const Status::ValueType kNoResult = 0x1001; ///< ValueObject::GetError() returns this if there is no result - ///from the expression. + /// from the expression. const char *GetFixedText() { if (m_fixed_text.empty()) @@ -281,7 +281,7 @@ protected: lldb::ExpressionVariableSP &result) = 0; static lldb::addr_t GetObjectPointer(lldb::StackFrameSP frame_sp, - ConstString &object_name, Error &err); + ConstString &object_name, Status &err); //------------------------------------------------------------------ /// Populate m_in_cplusplus_method and m_in_objectivec_method based on the diff --git a/contrib/llvm/tools/lldb/include/lldb/Expression/UtilityFunction.h b/contrib/llvm/tools/lldb/include/lldb/Expression/UtilityFunction.h index 0e2b87d..9c54db3 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Expression/UtilityFunction.h +++ b/contrib/llvm/tools/lldb/include/lldb/Expression/UtilityFunction.h @@ -123,7 +123,7 @@ public: FunctionCaller *MakeFunctionCaller(const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP compilation_thread, - Error &error); + Status &error); // This one retrieves the function caller that is already made. If you // haven't made it yet, this returns nullptr diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/Config.h b/contrib/llvm/tools/lldb/include/lldb/Host/Config.h deleted file mode 100644 index 16845ae..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/Config.h +++ /dev/null @@ -1,48 +0,0 @@ -//===-- Config.h ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_Config_h_ -#define liblldb_Config_h_ - -#if defined(__APPLE__) - -#include "lldb/Host/macosx/Config.h" - -#elif defined(__ANDROID__) - -#include "lldb/Host/android/Config.h" - -#elif defined(__linux__) || defined(__GNU__) - -#include "lldb/Host/linux/Config.h" - -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ - defined(__OpenBSD__) - -#include "lldb/Host/freebsd/Config.h" - -#elif defined(__NetBSD__) - -#include "lldb/Host/netbsd/Config.h" - -#elif defined(__MINGW__) || defined(__MINGW32__) - -#include "lldb/Host/mingw/Config.h" - -#elif defined(_MSC_VER) - -#include "lldb/Host/msvc/Config.h" - -#else - -#error undefined platform - -#endif - -#endif // #ifndef liblldb_Config_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/Config.h.cmake b/contrib/llvm/tools/lldb/include/lldb/Host/Config.h.cmake new file mode 100644 index 0000000..0deedd1 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Host/Config.h.cmake @@ -0,0 +1,27 @@ +//===-- Config.h -----------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_HOST_CONFIG_H +#define LLDB_HOST_CONFIG_H + +#cmakedefine LLDB_CONFIG_TERMIOS_SUPPORTED + +#cmakedefine LLDB_DISABLE_POSIX + +#cmakedefine01 HAVE_SYS_EVENT_H + +#cmakedefine01 HAVE_PPOLL + +#cmakedefine01 HAVE_SIGACTION + +#cmakedefine01 HAVE_PROCESS_VM_READV + +#cmakedefine01 HAVE_NR_PROCESS_VM_READV + +#endif // #ifndef LLDB_HOST_CONFIG_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/Editline.h b/contrib/llvm/tools/lldb/include/lldb/Host/Editline.h index faed373..0b75e9c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/Editline.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/Editline.h @@ -43,7 +43,8 @@ // will only be // used in cases where this is true. This is a compile time dependecy, for now // selected per target Platform -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ + defined(__OpenBSD__) #define LLDB_EDITLINE_USE_WCHAR 1 #include <codecvt> #else @@ -64,8 +65,8 @@ #include <vector> #include "lldb/Host/ConnectionFileDescriptor.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Host/Predicate.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { namespace line_editor { @@ -81,8 +82,14 @@ using EditLineStringStreamType = std::stringstream; using EditLineCharType = char; #endif +#ifdef EL_CLIENTDATA /* editline with wide support + wide char read function */ +using EditLineGetCharType = wchar_t; +#else +using EditLineGetCharType = char; +#endif + typedef int (*EditlineGetCharCallbackType)(::EditLine *editline, - EditLineCharType *c); + EditLineGetCharType *c); typedef unsigned char (*EditlineCommandCallbackType)(::EditLine *editline, int ch); typedef const char *(*EditlinePromptCallbackType)(::EditLine *editline); @@ -269,7 +276,7 @@ private: /// Character reading implementation for EditLine that supports our multi-line /// editing trickery. - int GetCharacter(EditLineCharType *c); + int GetCharacter(EditLineGetCharType *c); /// Prompt implementation for EditLine. const char *Prompt(); @@ -322,7 +329,7 @@ private: /// single or multi-line editing. void ConfigureEditor(bool multiline); - bool CompleteCharacter(char ch, EditLineCharType &out); + bool CompleteCharacter(char ch, EditLineGetCharType &out); private: #if LLDB_EDITLINE_USE_WCHAR diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/File.h b/contrib/llvm/tools/lldb/include/lldb/Host/File.h index 6fa4e56..1dfa12e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/File.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/File.h @@ -10,18 +10,15 @@ #ifndef liblldb_File_h_ #define liblldb_File_h_ -// C Includes -// C++ Includes +#include "lldb/Host/PosixApi.h" +#include "lldb/Utility/IOObject.h" +#include "lldb/Utility/Status.h" +#include "lldb/lldb-private.h" + #include <stdarg.h> #include <stdio.h> #include <sys/types.h> -// Other libraries and framework includes -// Project includes -#include "lldb/Host/IOObject.h" -#include "lldb/Host/PosixApi.h" -#include "lldb/lldb-private.h" - namespace lldb_private { //---------------------------------------------------------------------- @@ -167,7 +164,7 @@ public: /// @return /// A reference to the file specification object. //------------------------------------------------------------------ - Error GetFileSpec(FileSpec &file_spec) const; + Status GetFileSpec(FileSpec &file_spec) const; //------------------------------------------------------------------ /// Open a file for read/writing with the specified options. @@ -184,10 +181,10 @@ public: /// @param[in] permissions /// Options to use when opening (see File::Permissions) //------------------------------------------------------------------ - Error Open(const char *path, uint32_t options, - uint32_t permissions = lldb::eFilePermissionsFileDefault); + Status Open(const char *path, uint32_t options, + uint32_t permissions = lldb::eFilePermissionsFileDefault); - Error Close() override; + Status Close() override; void Clear(); @@ -219,7 +216,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Read(void *buf, size_t &num_bytes) override; + Status Read(void *buf, size_t &num_bytes) override; //------------------------------------------------------------------ /// Write bytes to a file at the current file position. @@ -240,7 +237,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Write(const void *buf, size_t &num_bytes) override; + Status Write(const void *buf, size_t &num_bytes) override; //------------------------------------------------------------------ /// Seek to an offset relative to the beginning of the file. @@ -256,13 +253,13 @@ public: /// beginning of the file. /// /// @param[in] error_ptr - /// A pointer to a lldb_private::Error object that will be + /// A pointer to a lldb_private::Status object that will be /// filled in if non-nullptr. /// /// @return /// The resulting seek offset, or -1 on error. //------------------------------------------------------------------ - off_t SeekFromStart(off_t offset, Error *error_ptr = nullptr); + off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Seek to an offset relative to the current file position. @@ -278,13 +275,13 @@ public: /// current file position. /// /// @param[in] error_ptr - /// A pointer to a lldb_private::Error object that will be + /// A pointer to a lldb_private::Status object that will be /// filled in if non-nullptr. /// /// @return /// The resulting seek offset, or -1 on error. //------------------------------------------------------------------ - off_t SeekFromCurrent(off_t offset, Error *error_ptr = nullptr); + off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Seek to an offset relative to the end of the file. @@ -301,13 +298,13 @@ public: /// absolute file offset. /// /// @param[in] error_ptr - /// A pointer to a lldb_private::Error object that will be + /// A pointer to a lldb_private::Status object that will be /// filled in if non-nullptr. /// /// @return /// The resulting seek offset, or -1 on error. //------------------------------------------------------------------ - off_t SeekFromEnd(off_t offset, Error *error_ptr = nullptr); + off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr); //------------------------------------------------------------------ /// Read bytes from a file from the specified file offset. @@ -332,7 +329,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Read(void *dst, size_t &num_bytes, off_t &offset); + Status Read(void *dst, size_t &num_bytes, off_t &offset); //------------------------------------------------------------------ /// Read bytes from a file from the specified file offset. @@ -363,8 +360,8 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Read(size_t &num_bytes, off_t &offset, bool null_terminate, - lldb::DataBufferSP &data_buffer_sp); + Status Read(size_t &num_bytes, off_t &offset, bool null_terminate, + lldb::DataBufferSP &data_buffer_sp); //------------------------------------------------------------------ /// Write bytes to a file at the specified file offset. @@ -391,7 +388,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Write(const void *src, size_t &num_bytes, off_t &offset); + Status Write(const void *src, size_t &num_bytes, off_t &offset); //------------------------------------------------------------------ /// Flush the current stream @@ -400,7 +397,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Flush(); + Status Flush(); //------------------------------------------------------------------ /// Sync to disk. @@ -409,7 +406,7 @@ public: /// An error object that indicates success or the reason for /// failure. //------------------------------------------------------------------ - Error Sync(); + Status Sync(); //------------------------------------------------------------------ /// Get the permissions for a this file. @@ -418,9 +415,9 @@ public: /// Bits logical OR'ed together from the permission bits defined /// in lldb_private::File::Permissions. //------------------------------------------------------------------ - uint32_t GetPermissions(Error &error) const; + uint32_t GetPermissions(Status &error) const; - static uint32_t GetPermissions(const FileSpec &file_spec, Error &error); + static uint32_t GetPermissions(const FileSpec &file_spec, Status &error); //------------------------------------------------------------------ /// Return true if this file is interactive. diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/FileCache.h b/contrib/llvm/tools/lldb/include/lldb/Host/FileCache.h index 1667d05..1c03540 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/FileCache.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/FileCache.h @@ -9,13 +9,14 @@ #ifndef liblldb_Host_FileCache_h #define liblldb_Host_FileCache_h +#include <map> #include <stdint.h> #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" -#include "lldb/Core/Error.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" namespace lldb_private { class FileCache { @@ -28,13 +29,13 @@ public: static FileCache &GetInstance(); lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, - uint32_t mode, Error &error); - bool CloseFile(lldb::user_id_t fd, Error &error); + uint32_t mode, Status &error); + bool CloseFile(lldb::user_id_t fd, Status &error); uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, - uint64_t src_len, Error &error); + uint64_t src_len, Status &error); uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, Error &error); + uint64_t dst_len, Status &error); private: static FileCache *m_instance; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/FileSystem.h b/contrib/llvm/tools/lldb/include/lldb/Host/FileSystem.h index 6dbea6d..c13d5c8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/FileSystem.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/FileSystem.h @@ -10,8 +10,8 @@ #ifndef liblldb_Host_FileSystem_h #define liblldb_Host_FileSystem_h -#include "lldb/Core/Error.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/Chrono.h" #include "lldb/lldb-types.h" @@ -26,47 +26,15 @@ public: static const char *DEV_NULL; static const char *PATH_CONVERSION_ERROR; - static FileSpec::PathSyntax GetNativePathSyntax(); + static Status Symlink(const FileSpec &src, const FileSpec &dst); + static Status Readlink(const FileSpec &src, FileSpec &dst); - static Error MakeDirectory(const FileSpec &file_spec, uint32_t mode); - static Error DeleteDirectory(const FileSpec &file_spec, bool recurse); - - static Error GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions); - static Error SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions); - static lldb::user_id_t GetFileSize(const FileSpec &file_spec); - static bool GetFileExists(const FileSpec &file_spec); - - static Error Hardlink(const FileSpec &src, const FileSpec &dst); - static int GetHardlinkCount(const FileSpec &file_spec); - static Error Symlink(const FileSpec &src, const FileSpec &dst); - static Error Readlink(const FileSpec &src, FileSpec &dst); - static Error Unlink(const FileSpec &file_spec); - - static Error ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); - - static bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, - uint64_t &high); - static bool CalculateMD5(const FileSpec &file_spec, uint64_t offset, - uint64_t length, uint64_t &low, uint64_t &high); - - static bool CalculateMD5AsString(const FileSpec &file_spec, - std::string &digest_str); - static bool CalculateMD5AsString(const FileSpec &file_spec, uint64_t offset, - uint64_t length, std::string &digest_str); - - /// Return \b true if \a spec is on a locally mounted file system, \b false - /// otherwise. - static bool IsLocal(const FileSpec &spec); + static Status ResolveSymbolicLink(const FileSpec &src, FileSpec &dst); /// Wraps ::fopen in a platform-independent way. Once opened, FILEs can be /// manipulated and closed with the normal ::fread, ::fclose, etc. functions. static FILE *Fopen(const char *path, const char *mode); - /// Wraps ::stat in a platform-independent way. - static int Stat(const char *path, struct stat *stats); - static llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec); }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/Host.h b/contrib/llvm/tools/lldb/include/lldb/Host/Host.h index 64c0dd6..da0b8e1 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/Host.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/Host.h @@ -7,21 +7,20 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Host_h_ -#define liblldb_Host_h_ -#if defined(__cplusplus) +#ifndef LLDB_HOST_HOST_H +#define LLDB_HOST_HOST_H -#include <stdarg.h> - -#include <map> -#include <string> - -#include "lldb/Core/StringList.h" #include "lldb/Host/File.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Host/HostThread.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-private.h" +#include <cerrno> +#include <map> +#include <stdarg.h> +#include <string> +#include <type_traits> namespace lldb_private { @@ -29,6 +28,27 @@ class FileAction; class ProcessLaunchInfo; //---------------------------------------------------------------------- +// Exit Type for inferior processes +//---------------------------------------------------------------------- +struct WaitStatus { + enum Type : uint8_t { + Exit, // The status represents the return code from normal + // program exit (i.e. WIFEXITED() was true) + Signal, // The status represents the signal number that caused + // the program to exit (i.e. WIFSIGNALED() was true) + Stop, // The status represents the signal number that caused the + // program to stop (i.e. WIFSTOPPED() was true) + }; + + Type type; + uint8_t status; + + WaitStatus(Type type, uint8_t status) : type(type), status(status) {} + + static WaitStatus Decode(int wstatus); +}; + +//---------------------------------------------------------------------- /// @class Host Host.h "lldb/Host/Host.h" /// @brief A class that provides host computer information. /// @@ -100,14 +120,6 @@ public: static void Kill(lldb::pid_t pid, int signo); //------------------------------------------------------------------ - /// Get the thread ID for the calling thread in the current process. - /// - /// @return - /// The thread ID for the calling thread in the current process. - //------------------------------------------------------------------ - static lldb::tid_t GetCurrentThreadID(); - - //------------------------------------------------------------------ /// Get the thread token (the one returned by ThreadCreate when the thread was /// created) for the /// calling thread in the current process. @@ -119,15 +131,6 @@ public: static const char *GetSignalAsCString(int signo); - typedef void (*ThreadLocalStorageCleanupCallback)(void *p); - - static lldb::thread_key_t - ThreadLocalStorageCreate(ThreadLocalStorageCleanupCallback callback); - - static void *ThreadLocalStorageGet(lldb::thread_key_t key); - - static void ThreadLocalStorageSet(lldb::thread_key_t key, void *value); - //------------------------------------------------------------------ /// Given an address in the current process (the process that /// is running the LLDB code), return the name of the module that @@ -192,25 +195,9 @@ public: static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info); -#if (defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || \ - defined(__GLIBC__) || defined(__NetBSD__)) && \ - !defined(__ANDROID__) - - static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info); - - static Error LaunchProcessPosixSpawn(const char *exe_path, - const ProcessLaunchInfo &launch_info, - lldb::pid_t &pid); - - static bool AddPosixSpawnFileAction(void *file_actions, - const FileAction *info, Log *log, - Error &error); - -#endif - static const lldb::UnixSignalsSP &GetUnixSignals(); - static Error LaunchProcess(ProcessLaunchInfo &launch_info); + static Status LaunchProcess(ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ /// Perform expansion of the command-line for this launch info @@ -219,10 +206,10 @@ public: // argument magic the platform defines as part of its typical // user experience //------------------------------------------------------------------ - static Error ShellExpandArguments(ProcessLaunchInfo &launch_info); + static Status ShellExpandArguments(ProcessLaunchInfo &launch_info); // TODO: Convert this function to take a StringRef. - static Error RunShellCommand( + static Status RunShellCommand( const char *command, // Shouldn't be NULL const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory @@ -234,7 +221,7 @@ public: uint32_t timeout_sec, bool run_in_default_shell = true); - static Error RunShellCommand( + static Status RunShellCommand( const Args &args, const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory @@ -246,17 +233,24 @@ public: uint32_t timeout_sec, bool run_in_default_shell = true); - static lldb::DataBufferSP GetAuxvData(lldb_private::Process *process); - - static lldb::DataBufferSP GetAuxvData(lldb::pid_t pid); - static bool OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t line_no); static size_t GetEnvironment(StringList &env); + + static std::unique_ptr<Connection> + CreateDefaultConnection(llvm::StringRef url); }; } // namespace lldb_private -#endif // #if defined(__cplusplus) -#endif // liblldb_Host_h_ +namespace llvm { +template <> struct format_provider<lldb_private::WaitStatus> { + /// Options = "" gives a human readable description of the status + /// Options = "g" gives a gdb-remote protocol status (e.g., X09) + static void format(const lldb_private::WaitStatus &WS, raw_ostream &OS, + llvm::StringRef Options); +}; +} // namespace llvm + +#endif // LLDB_HOST_HOST_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostInfo.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostInfo.h index 4646be2..b4a2f8b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostInfo.h @@ -51,6 +51,9 @@ #elif defined(__NetBSD__) #include "lldb/Host/netbsd/HostInfoNetBSD.h" #define HOST_INFO_TYPE HostInfoNetBSD +#elif defined(__OpenBSD__) +#include "lldb/Host/openbsd/HostInfoOpenBSD.h" +#define HOST_INFO_TYPE HostInfoOpenBSD #elif defined(__APPLE__) #include "lldb/Host/macosx/HostInfoMacOSX.h" #define HOST_INFO_TYPE HostInfoMacOSX diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostInfoBase.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostInfoBase.h index 74ac79b..42e3fc3 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostInfoBase.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostInfoBase.h @@ -11,7 +11,7 @@ #define lldb_Host_HostInfoBase_h_ #include "lldb/Core/ArchSpec.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-enumerations.h" #include "llvm/ADT/StringRef.h" @@ -35,39 +35,6 @@ public: static void Terminate(); //------------------------------------------------------------------ - /// Returns the number of CPUs on this current host. - /// - /// @return - /// Number of CPUs on this current host, or zero if the number - /// of CPUs can't be determined on this host. - //------------------------------------------------------------------ - static uint32_t GetNumberCPUS(); - - //------------------------------------------------------------------ - /// Returns the maximum length of a thread name on this platform. - /// - /// @return - /// Maximum length of a thread name on this platform. - //------------------------------------------------------------------ - static uint32_t GetMaxThreadNameLength(); - - //------------------------------------------------------------------ - /// Gets the host vendor string. - /// - /// @return - /// A const string object containing the host vendor name. - //------------------------------------------------------------------ - static llvm::StringRef GetVendorString(); - - //------------------------------------------------------------------ - /// Gets the host Operating System (OS) string. - /// - /// @return - /// A const string object containing the host OS name. - //------------------------------------------------------------------ - static llvm::StringRef GetOSString(); - - //------------------------------------------------------------------ /// Gets the host target triple as a const string. /// /// @return diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeProcessBase.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeProcessBase.h index 204f78e..07f98c2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeProcessBase.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeProcessBase.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_HostNativeProcessBase_h_ #define lldb_Host_HostNativeProcessBase_h_ -#include "lldb/Core/Error.h" #include "lldb/Host/HostProcess.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" @@ -28,8 +28,8 @@ public: : m_process(process) {} virtual ~HostNativeProcessBase() {} - virtual Error Terminate() = 0; - virtual Error GetMainModule(FileSpec &file_spec) const = 0; + virtual Status Terminate() = 0; + virtual Status GetMainModule(FileSpec &file_spec) const = 0; virtual lldb::pid_t GetProcessId() const = 0; virtual bool IsRunning() const = 0; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThread.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThread.h index b0411ca..e33d978 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThread.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThread.h @@ -14,14 +14,10 @@ #if defined(_WIN32) #include "lldb/Host/windows/HostThreadWindows.h" -#elif defined(__linux__) -#include "lldb/Host/linux/HostThreadLinux.h" -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#include "lldb/Host/freebsd/HostThreadFreeBSD.h" -#elif defined(__NetBSD__) -#include "lldb/Host/netbsd/HostThreadNetBSD.h" #elif defined(__APPLE__) #include "lldb/Host/macosx/HostThreadMacOSX.h" +#else +#include "lldb/Host/posix/HostThreadPosix.h" #endif #endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadBase.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadBase.h index 284b754..f1f89f3 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadBase.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadBase.h @@ -10,7 +10,7 @@ #ifndef lldb_Host_HostNativeThreadBase_h_ #define lldb_Host_HostNativeThreadBase_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" @@ -31,8 +31,8 @@ public: explicit HostNativeThreadBase(lldb::thread_t thread); virtual ~HostNativeThreadBase() {} - virtual Error Join(lldb::thread_result_t *result) = 0; - virtual Error Cancel() = 0; + virtual Status Join(lldb::thread_result_t *result) = 0; + virtual Status Cancel() = 0; virtual bool IsJoinable() const; virtual void Reset(); lldb::thread_t Release(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadForward.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadForward.h index 5b83213..4691a22 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadForward.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostNativeThreadForward.h @@ -14,18 +14,12 @@ namespace lldb_private { #if defined(_WIN32) class HostThreadWindows; typedef HostThreadWindows HostNativeThread; -#elif defined(__linux__) -class HostThreadLinux; -typedef HostThreadLinux HostNativeThread; -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -class HostThreadFreeBSD; -typedef HostThreadFreeBSD HostNativeThread; -#elif defined(__NetBSD__) -class HostThreadNetBSD; -typedef HostThreadNetBSD HostNativeThread; #elif defined(__APPLE__) class HostThreadMacOSX; typedef HostThreadMacOSX HostNativeThread; +#else +class HostThreadPosix; +typedef HostThreadPosix HostNativeThread; #endif } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostProcess.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostProcess.h index 56c3ddd..dfc997b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostProcess.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostProcess.h @@ -40,8 +40,8 @@ public: HostProcess(lldb::process_t process); ~HostProcess(); - Error Terminate(); - Error GetMainModule(FileSpec &file_spec) const; + Status Terminate(); + Status GetMainModule(FileSpec &file_spec) const; lldb::pid_t GetProcessId() const; bool IsRunning() const; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/HostThread.h b/contrib/llvm/tools/lldb/include/lldb/Host/HostThread.h index d14f0f6..0d2fbe6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/HostThread.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/HostThread.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_HostThread_h_ #define lldb_Host_HostThread_h_ -#include "lldb/Core/Error.h" #include "lldb/Host/HostNativeThreadForward.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" #include <memory> @@ -34,8 +34,8 @@ public: HostThread(); HostThread(lldb::thread_t thread); - Error Join(lldb::thread_result_t *result); - Error Cancel(); + Status Join(lldb::thread_result_t *result); + Status Cancel(); void Reset(); lldb::thread_t Release(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/LockFileBase.h b/contrib/llvm/tools/lldb/include/lldb/Host/LockFileBase.h index 3b2f723..4eda191 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/LockFileBase.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/LockFileBase.h @@ -10,7 +10,7 @@ #ifndef liblldb_Host_LockFileBase_h_ #define liblldb_Host_LockFileBase_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Status.h" #include <functional> @@ -22,30 +22,30 @@ public: bool IsLocked() const; - Error WriteLock(const uint64_t start, const uint64_t len); - Error TryWriteLock(const uint64_t start, const uint64_t len); + Status WriteLock(const uint64_t start, const uint64_t len); + Status TryWriteLock(const uint64_t start, const uint64_t len); - Error ReadLock(const uint64_t start, const uint64_t len); - Error TryReadLock(const uint64_t start, const uint64_t len); + Status ReadLock(const uint64_t start, const uint64_t len); + Status TryReadLock(const uint64_t start, const uint64_t len); - Error Unlock(); + Status Unlock(); protected: - using Locker = std::function<Error(const uint64_t, const uint64_t)>; + using Locker = std::function<Status(const uint64_t, const uint64_t)>; LockFileBase(int fd); virtual bool IsValidFile() const; - virtual Error DoWriteLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoTryWriteLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoWriteLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoTryWriteLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoReadLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoTryReadLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoReadLock(const uint64_t start, const uint64_t len) = 0; + virtual Status DoTryReadLock(const uint64_t start, const uint64_t len) = 0; - virtual Error DoUnlock() = 0; + virtual Status DoUnlock() = 0; - Error DoLock(const Locker &locker, const uint64_t start, const uint64_t len); + Status DoLock(const Locker &locker, const uint64_t start, const uint64_t len); int m_fd; // not owned. bool m_locked; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/MainLoop.h b/contrib/llvm/tools/lldb/include/lldb/Host/MainLoop.h index 8aa26b6..5ac145f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/MainLoop.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/MainLoop.h @@ -10,16 +10,103 @@ #ifndef lldb_Host_MainLoop_h_ #define lldb_Host_MainLoop_h_ -#ifdef _WIN32 +#include "lldb/Host/Config.h" #include "lldb/Host/MainLoopBase.h" +#include "llvm/ADT/DenseMap.h" +#include <csignal> + +#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H +#define SIGNAL_POLLING_UNSUPPORTED 1 +#endif + namespace lldb_private { -typedef MainLoopBase MainLoop; -} -#else -#include "lldb/Host/posix/MainLoopPosix.h" -namespace lldb_private { -typedef MainLoopPosix MainLoop; -} + +// Implementation of the MainLoopBase class. It can monitor file descriptors for +// readability using ppoll, kqueue, poll or WSAPoll. On Windows it only supports +// polling sockets, and will not work on generic file handles or pipes. On +// systems without kqueue or ppoll handling singnals is not supported. In +// addition to the common base, this class provides the ability to invoke a +// given handler when a signal is received. +// +// Since this class is primarily intended to be used for single-threaded +// processing, it does not attempt to perform any internal synchronisation and +// any concurrent accesses must be protected externally. However, it is +// perfectly legitimate to have more than one instance of this class running on +// separate threads, or even a single thread (with some limitations on signal +// monitoring). +// TODO: Add locking if this class is to be used in a multi-threaded context. +class MainLoop : public MainLoopBase { +private: + class SignalHandle; + +public: + typedef std::unique_ptr<SignalHandle> SignalHandleUP; + + MainLoop(); + ~MainLoop() override; + + ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, + const Callback &callback, + Status &error) override; + + // Listening for signals from multiple MainLoop instances is perfectly safe as + // long as they don't try to listen for the same signal. The callback function + // is invoked when the control returns to the Run() function, not when the + // hander is executed. This mean that you can treat the callback as a normal + // function and perform things which would not be safe in a signal handler. + // However, since the callback is not invoked synchronously, you cannot use + // this mechanism to handle SIGSEGV and the like. + SignalHandleUP RegisterSignal(int signo, const Callback &callback, + Status &error); + + Status Run() override; + + // This should only be performed from a callback. Do not attempt to terminate + // the processing from another thread. + // TODO: Add synchronization if we want to be terminated from another thread. + void RequestTermination() override { m_terminate_request = true; } + +protected: + void UnregisterReadObject(IOObject::WaitableHandle handle) override; + + void UnregisterSignal(int signo); + +private: + void ProcessReadObject(IOObject::WaitableHandle handle); + void ProcessSignal(int signo); + + class SignalHandle { + public: + ~SignalHandle() { m_mainloop.UnregisterSignal(m_signo); } + + private: + SignalHandle(MainLoop &mainloop, int signo) + : m_mainloop(mainloop), m_signo(signo) {} + + MainLoop &m_mainloop; + int m_signo; + + friend class MainLoop; + DISALLOW_COPY_AND_ASSIGN(SignalHandle); + }; + + struct SignalInfo { + Callback callback; +#if HAVE_SIGACTION + struct sigaction old_action; #endif + bool was_blocked : 1; + }; + class RunImpl; + + llvm::DenseMap<IOObject::WaitableHandle, Callback> m_read_fds; + llvm::DenseMap<int, SignalInfo> m_signals; +#if HAVE_SYS_EVENT_H + int m_kqueue; +#endif + bool m_terminate_request : 1; +}; + +} // namespace lldb_private #endif // lldb_Host_MainLoop_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/MainLoopBase.h b/contrib/llvm/tools/lldb/include/lldb/Host/MainLoopBase.h index cd29796..a87d262 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/MainLoopBase.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/MainLoopBase.h @@ -10,12 +10,10 @@ #ifndef lldb_Host_posix_MainLoopBase_h_ #define lldb_Host_posix_MainLoopBase_h_ -#include <functional> - +#include "lldb/Utility/IOObject.h" +#include "lldb/Utility/Status.h" #include "llvm/Support/ErrorHandling.h" - -#include "lldb/Core/Error.h" -#include "lldb/Host/IOObject.h" +#include <functional> namespace lldb_private { @@ -49,14 +47,14 @@ public: virtual ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, const Callback &callback, - Error &error) { + Status &error) { llvm_unreachable("Not implemented"); } // Waits for registered events and invoke the proper callbacks. Returns when // all callbacks // deregister themselves or when someone requests termination. - virtual Error Run() { llvm_unreachable("Not implemented"); } + virtual Status Run() { llvm_unreachable("Not implemented"); } // Requests the exit of the Run() function. virtual void RequestTermination() { llvm_unreachable("Not implemented"); } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/MonitoringProcessLauncher.h b/contrib/llvm/tools/lldb/include/lldb/Host/MonitoringProcessLauncher.h index 7aa819a..9ad36e9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/MonitoringProcessLauncher.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/MonitoringProcessLauncher.h @@ -25,7 +25,7 @@ public: std::unique_ptr<ProcessLauncher> delegate_launcher); HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) override; + Status &error) override; private: std::unique_ptr<ProcessLauncher> m_delegate_launcher; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/PipeBase.h b/contrib/llvm/tools/lldb/include/lldb/Host/PipeBase.h index e3d7c25..ad62072 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/PipeBase.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/PipeBase.h @@ -14,7 +14,7 @@ #include <chrono> #include <string> -#include "lldb/Core/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" @@ -23,17 +23,18 @@ class PipeBase { public: virtual ~PipeBase(); - virtual Error CreateNew(bool child_process_inherit) = 0; - virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0; - virtual Error CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, - llvm::SmallVectorImpl<char> &name) = 0; + virtual Status CreateNew(bool child_process_inherit) = 0; + virtual Status CreateNew(llvm::StringRef name, + bool child_process_inherit) = 0; + virtual Status CreateWithUniqueName(llvm::StringRef prefix, + bool child_process_inherit, + llvm::SmallVectorImpl<char> &name) = 0; - virtual Error OpenAsReader(llvm::StringRef name, - bool child_process_inherit) = 0; + virtual Status OpenAsReader(llvm::StringRef name, + bool child_process_inherit) = 0; - Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit); - virtual Error + Status OpenAsWriter(llvm::StringRef name, bool child_process_inherit); + virtual Status OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) = 0; @@ -51,13 +52,13 @@ public: virtual void Close() = 0; // Delete named pipe. - virtual Error Delete(llvm::StringRef name) = 0; + virtual Status Delete(llvm::StringRef name) = 0; - virtual Error Write(const void *buf, size_t size, size_t &bytes_written) = 0; - virtual Error ReadWithTimeout(void *buf, size_t size, - const std::chrono::microseconds &timeout, - size_t &bytes_read) = 0; - Error Read(void *buf, size_t size, size_t &bytes_read); + virtual Status Write(const void *buf, size_t size, size_t &bytes_written) = 0; + virtual Status ReadWithTimeout(void *buf, size_t size, + const std::chrono::microseconds &timeout, + size_t &bytes_read) = 0; + Status Read(void *buf, size_t size, size_t &bytes_read); }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/PosixApi.h b/contrib/llvm/tools/lldb/include/lldb/Host/PosixApi.h index 23a291c..d5c48dd6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/PosixApi.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/PosixApi.h @@ -14,10 +14,10 @@ // to provide a minimum level of compatibility across all platforms to rely // on various posix api functionality. -#include "llvm/Support/Compiler.h" - -#if defined(LLVM_ON_WIN32) +#if defined(_WIN32) #include "lldb/Host/windows/PosixApi.h" +#else +#include <unistd.h> #endif #endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/ProcessLauncher.h b/contrib/llvm/tools/lldb/include/lldb/Host/ProcessLauncher.h index 12049a6..49fa841 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/ProcessLauncher.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/ProcessLauncher.h @@ -13,14 +13,14 @@ namespace lldb_private { class ProcessLaunchInfo; -class Error; +class Status; class HostProcess; class ProcessLauncher { public: virtual ~ProcessLauncher() {} virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) = 0; + Status &error) = 0; }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/PseudoTerminal.h b/contrib/llvm/tools/lldb/include/lldb/Host/PseudoTerminal.h index fbe9334..fdbf6df 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/PseudoTerminal.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/PseudoTerminal.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_PseudoTerminal_h_ -#define liblldb_PseudoTerminal_h_ +#ifndef LLDB_HOST_PSEUDOTERMINAL_H +#define LLDB_HOST_PSEUDOTERMINAL_H #if defined(__cplusplus) #include <fcntl.h> @@ -19,7 +19,7 @@ namespace lldb_utility { //---------------------------------------------------------------------- -/// @class PseudoTerminal PseudoTerminal.h "lldb/Core/PseudoTerminal.h" +/// @class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h" /// @brief A pseudo terminal helper class. /// /// The pseudo terminal class abstracts the use of pseudo terminals on diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/Socket.h b/contrib/llvm/tools/lldb/include/lldb/Host/Socket.h index 1ad3ca7..37f468f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/Socket.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/Socket.h @@ -15,10 +15,10 @@ #include "lldb/lldb-private.h" -#include "lldb/Core/Error.h" -#include "lldb/Host/IOObject.h" #include "lldb/Host/Predicate.h" #include "lldb/Host/SocketAddress.h" +#include "lldb/Utility/IOObject.h" +#include "lldb/Utility/Status.h" #ifdef _WIN32 #include "lldb/Host/windows/windows.h" @@ -53,36 +53,35 @@ public: static std::unique_ptr<Socket> Create(const SocketProtocol protocol, bool child_processes_inherit, - Error &error); + Status &error); - virtual Error Connect(llvm::StringRef name) = 0; - virtual Error Listen(llvm::StringRef name, int backlog) = 0; - virtual Error Accept(llvm::StringRef name, bool child_processes_inherit, - Socket *&socket) = 0; + virtual Status Connect(llvm::StringRef name) = 0; + virtual Status Listen(llvm::StringRef name, int backlog) = 0; + virtual Status Accept(Socket *&socket) = 0; // Initialize a Tcp Socket object in listening mode. listen and accept are // implemented // separately because the caller may wish to manipulate or query the socket // after it is // initialized, but before entering a blocking accept. - static Error TcpListen(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket, - Predicate<uint16_t> *predicate, int backlog = 5); - static Error TcpConnect(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket); - static Error UdpConnect(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&send_socket, - Socket *&recv_socket); - static Error UnixDomainConnect(llvm::StringRef host_and_port, + static Status TcpListen(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket, + Predicate<uint16_t> *predicate, int backlog = 5); + static Status TcpConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket); + static Status UdpConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, Socket *&socket); + static Status UnixDomainConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, + Socket *&socket); + static Status UnixDomainAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket); - static Error UnixDomainAccept(llvm::StringRef host_and_port, - bool child_processes_inherit, Socket *&socket); - static Error UnixAbstractConnect(llvm::StringRef host_and_port, + static Status UnixAbstractConnect(llvm::StringRef host_and_port, + bool child_processes_inherit, + Socket *&socket); + static Status UnixAbstractAccept(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket); - static Error UnixAbstractAccept(llvm::StringRef host_and_port, - bool child_processes_inherit, - Socket *&socket); int GetOption(int level, int option_name, int &option_value); int SetOption(int level, int option_name, int option_value); @@ -90,34 +89,36 @@ public: NativeSocket GetNativeSocket() const { return m_socket; } SocketProtocol GetSocketProtocol() const { return m_protocol; } - Error Read(void *buf, size_t &num_bytes) override; - Error Write(const void *buf, size_t &num_bytes) override; + Status Read(void *buf, size_t &num_bytes) override; + Status Write(const void *buf, size_t &num_bytes) override; - virtual Error PreDisconnect(); - Error Close() override; + virtual Status PreDisconnect(); + Status Close() override; bool IsValid() const override { return m_socket != kInvalidSocketValue; } WaitableHandle GetWaitableHandle() override; static bool DecodeHostAndPort(llvm::StringRef host_and_port, std::string &host_str, std::string &port_str, - int32_t &port, Error *error_ptr); + int32_t &port, Status *error_ptr); protected: - Socket(NativeSocket socket, SocketProtocol protocol, bool should_close); + Socket(SocketProtocol protocol, bool should_close, + bool m_child_process_inherit); virtual size_t Send(const void *buf, const size_t num_bytes); - static void SetLastError(Error &error); + static void SetLastError(Status &error); static NativeSocket CreateSocket(const int domain, const int type, const int protocol, - bool child_processes_inherit, Error &error); + bool child_processes_inherit, Status &error); static NativeSocket AcceptSocket(NativeSocket sockfd, struct sockaddr *addr, socklen_t *addrlen, - bool child_processes_inherit, Error &error); + bool child_processes_inherit, Status &error); SocketProtocol m_protocol; NativeSocket m_socket; + bool m_child_processes_inherit; }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/SocketAddress.h b/contrib/llvm/tools/lldb/include/lldb/Host/SocketAddress.h index 3d1ed90..ebc6f4e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/SocketAddress.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/SocketAddress.h @@ -32,15 +32,24 @@ typedef ADDRESS_FAMILY sa_family_t; // Other libraries and framework includes // Project includes #include <string> +#include <vector> namespace lldb_private { class SocketAddress { public: + //---------------------------------------------------------------------------- + // Static method to get all address information for a host and/or service + //---------------------------------------------------------------------------- + static std::vector<SocketAddress> + GetAddressInfo(const char *hostname, const char *servname, int ai_family, + int ai_socktype, int ai_protocol, int ai_flags = 0); + //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ SocketAddress(); + SocketAddress(const struct addrinfo *addr_info); SocketAddress(const struct sockaddr &s); SocketAddress(const struct sockaddr_in &s); SocketAddress(const struct sockaddr_in6 &s); @@ -63,6 +72,9 @@ public: const SocketAddress &operator=(const struct sockaddr_storage &s); + bool operator==(const SocketAddress &rhs) const; + bool operator!=(const SocketAddress &rhs) const; + //------------------------------------------------------------------ // Clear the contents of this socket address //------------------------------------------------------------------ @@ -135,6 +147,16 @@ public: bool IsValid() const; //------------------------------------------------------------------ + // Returns true if the socket is INADDR_ANY + //------------------------------------------------------------------ + bool IsAnyAddr() const; + + //------------------------------------------------------------------ + // Returns true if the socket is INADDR_LOOPBACK + //------------------------------------------------------------------ + bool IsLocalhost() const; + + //------------------------------------------------------------------ // Direct access to all of the sockaddr structures //------------------------------------------------------------------ struct sockaddr &sockaddr() { diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/Symbols.h b/contrib/llvm/tools/lldb/include/lldb/Host/Symbols.h index 1339c06..5f8632d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/Symbols.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/Symbols.h @@ -16,10 +16,14 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { +class ArchSpec; +class ModuleSpec; +class UUID; + class Symbols { public: //---------------------------------------------------------------------- diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/ThisThread.h b/contrib/llvm/tools/lldb/include/lldb/Host/ThisThread.h deleted file mode 100644 index 1392b10..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/ThisThread.h +++ /dev/null @@ -1,37 +0,0 @@ -//===-- ThisThread.h --------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_ThisThread_h_ -#define lldb_Host_ThisThread_h_ - -#include "llvm/ADT/StringRef.h" - -#include <string> - -namespace llvm { -template <class T> class SmallVectorImpl; -} - -namespace lldb_private { - -class ThisThread { -private: - ThisThread(); - -public: - // ThisThread common functions. - static void SetName(llvm::StringRef name, int max_length); - - // ThisThread platform-specific functions. - static void SetName(llvm::StringRef name); - static void GetName(llvm::SmallVectorImpl<char> &name); -}; -} - -#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/ThreadLauncher.h b/contrib/llvm/tools/lldb/include/lldb/Host/ThreadLauncher.h index 0f2cb37..b50f0e2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/ThreadLauncher.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/ThreadLauncher.h @@ -11,8 +11,8 @@ #ifndef lldb_Host_ThreadLauncher_h_ #define lldb_Host_ThreadLauncher_h_ -#include "lldb/Core/Error.h" #include "lldb/Host/HostThread.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" #include "llvm/ADT/StringRef.h" @@ -23,7 +23,7 @@ class ThreadLauncher { public: static HostThread LaunchThread(llvm::StringRef name, lldb::thread_func_t thread_function, - lldb::thread_arg_t thread_arg, Error *error_ptr, + lldb::thread_arg_t thread_arg, Status *error_ptr, size_t min_stack_byte_size = 0); // Minimum stack size in bytes, // set stack size to zero for // default platform thread stack diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/XML.h b/contrib/llvm/tools/lldb/include/lldb/Host/XML.h index 4113b33..96b5227 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/XML.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/XML.h @@ -24,8 +24,8 @@ #include "llvm/ADT/StringRef.h" // Project includes -#include "lldb/Core/StreamString.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpoint.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpoint.h index 2f872e1..73639d6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpoint.h @@ -24,9 +24,9 @@ public: virtual ~NativeBreakpoint(); - Error Enable(); + Status Enable(); - Error Disable(); + Status Disable(); lldb::addr_t GetAddress() const { return m_addr; } @@ -38,9 +38,9 @@ protected: const lldb::addr_t m_addr; int32_t m_ref_count; - virtual Error DoEnable() = 0; + virtual Status DoEnable() = 0; - virtual Error DoDisable() = 0; + virtual Status DoDisable() = 0; private: bool m_enabled; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpointList.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpointList.h index 2bb8e56..ffa659f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpointList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeBreakpointList.h @@ -10,7 +10,7 @@ #ifndef liblldb_NativeBreakpointList_h_ #define liblldb_NativeBreakpointList_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-forward.h" // #include "lldb/Host/NativeBreakpoint.h" @@ -19,26 +19,35 @@ #include <mutex> namespace lldb_private { + +struct HardwareBreakpoint { + lldb::addr_t m_addr; + size_t m_size; +}; + +using HardwareBreakpointMap = std::map<lldb::addr_t, HardwareBreakpoint>; + class NativeBreakpointList { public: - typedef std::function<Error(lldb::addr_t addr, size_t size_hint, - bool hardware, NativeBreakpointSP &breakpoint_sp)> + typedef std::function<Status(lldb::addr_t addr, size_t size_hint, + bool hardware, + NativeBreakpointSP &breakpoint_sp)> CreateBreakpointFunc; NativeBreakpointList(); - Error AddRef(lldb::addr_t addr, size_t size_hint, bool hardware, - CreateBreakpointFunc create_func); + Status AddRef(lldb::addr_t addr, size_t size_hint, bool hardware, + CreateBreakpointFunc create_func); - Error DecRef(lldb::addr_t addr); + Status DecRef(lldb::addr_t addr); - Error EnableBreakpoint(lldb::addr_t addr); + Status EnableBreakpoint(lldb::addr_t addr); - Error DisableBreakpoint(lldb::addr_t addr); + Status DisableBreakpoint(lldb::addr_t addr); - Error GetBreakpoint(lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp); + Status GetBreakpoint(lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp); - Error RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const; + Status RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const; private: typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeProcessProtocol.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeProcessProtocol.h index a0f03b0..9671d71 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeProcessProtocol.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeProcessProtocol.h @@ -10,14 +10,18 @@ #ifndef liblldb_NativeProcessProtocol_h_ #define liblldb_NativeProcessProtocol_h_ -#include <mutex> -#include <vector> - -#include "lldb/Core/Error.h" +#include "lldb/Host/Host.h" #include "lldb/Host/MainLoop.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/TraceOptions.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-types.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/MemoryBuffer.h" +#include <vector> #include "NativeBreakpointList.h" #include "NativeWatchpointList.h" @@ -29,18 +33,17 @@ class ResumeActionList; //------------------------------------------------------------------ // NativeProcessProtocol //------------------------------------------------------------------ -class NativeProcessProtocol - : public std::enable_shared_from_this<NativeProcessProtocol> { +class NativeProcessProtocol { friend class SoftwareBreakpoint; public: virtual ~NativeProcessProtocol() {} - virtual Error Resume(const ResumeActionList &resume_actions) = 0; + virtual Status Resume(const ResumeActionList &resume_actions) = 0; - virtual Error Halt() = 0; + virtual Status Halt() = 0; - virtual Error Detach() = 0; + virtual Status Detach() = 0; //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. @@ -48,7 +51,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error Signal(int signo) = 0; + virtual Status Signal(int signo) = 0; //------------------------------------------------------------------ /// Tells a process to interrupt all operations as if by a Ctrl-C. @@ -60,30 +63,36 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error Interrupt(); + virtual Status Interrupt(); - virtual Error Kill() = 0; + virtual Status Kill() = 0; + + //------------------------------------------------------------------ + // Tells a process not to stop the inferior on given signals + // and just reinject them back. + //------------------------------------------------------------------ + virtual Status IgnoreSignals(llvm::ArrayRef<int> signals); //---------------------------------------------------------------------- // Memory and memory region functions //---------------------------------------------------------------------- - virtual Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info); + virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info); - virtual Error ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) = 0; + virtual Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) = 0; - virtual Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) = 0; + virtual Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, + size_t size, size_t &bytes_read) = 0; - virtual Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size, - size_t &bytes_written) = 0; + virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, + size_t &bytes_written) = 0; - virtual Error AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) = 0; + virtual Status AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) = 0; - virtual Error DeallocateMemory(lldb::addr_t addr) = 0; + virtual Status DeallocateMemory(lldb::addr_t addr) = 0; virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0; @@ -96,26 +105,36 @@ public: //---------------------------------------------------------------------- // Breakpoint functions //---------------------------------------------------------------------- - virtual Error SetBreakpoint(lldb::addr_t addr, uint32_t size, - bool hardware) = 0; + virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) = 0; - virtual Error RemoveBreakpoint(lldb::addr_t addr); + virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware = false); + + virtual Status EnableBreakpoint(lldb::addr_t addr); + + virtual Status DisableBreakpoint(lldb::addr_t addr); + + //---------------------------------------------------------------------- + // Hardware Breakpoint functions + //---------------------------------------------------------------------- + virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const; - virtual Error EnableBreakpoint(lldb::addr_t addr); + virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size); - virtual Error DisableBreakpoint(lldb::addr_t addr); + virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr); //---------------------------------------------------------------------- // Watchpoint functions //---------------------------------------------------------------------- virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const; - virtual uint32_t GetMaxWatchpoints() const; + virtual llvm::Optional<std::pair<uint32_t, uint32_t>> + GetHardwareDebugSupportInfo() const; - virtual Error SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware); + virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware); - virtual Error RemoveWatchpoint(lldb::addr_t addr); + virtual Status RemoveWatchpoint(lldb::addr_t addr); //---------------------------------------------------------------------- // Accessors @@ -134,15 +153,15 @@ public: bool GetByteOrder(lldb::ByteOrder &byte_order) const; + virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> + GetAuxvData() const = 0; + //---------------------------------------------------------------------- // Exit Status //---------------------------------------------------------------------- - virtual bool GetExitStatus(lldb_private::ExitType *exit_type, int *status, - std::string &exit_description); + virtual llvm::Optional<WaitStatus> GetExitStatus(); - virtual bool SetExitStatus(lldb_private::ExitType exit_type, int status, - const char *exit_description, - bool bNotifyStateChange); + virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange); //---------------------------------------------------------------------- // Access to threads @@ -219,101 +238,197 @@ public: //------------------------------------------------------------------ bool UnregisterNativeDelegate(NativeDelegate &native_delegate); - virtual Error GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) = 0; + virtual Status GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) = 0; + + virtual Status GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) = 0; - virtual Error GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) = 0; + class Factory { + public: + virtual ~Factory(); + //------------------------------------------------------------------ + /// Launch a process for debugging. + /// + /// @param[in] launch_info + /// Information required to launch the process. + /// + /// @param[in] native_delegate + /// The delegate that will receive messages regarding the + /// inferior. Must outlive the NativeProcessProtocol + /// instance. + /// + /// @param[in] mainloop + /// The mainloop instance with which the process can register + /// callbacks. Must outlive the NativeProcessProtocol + /// instance. + /// + /// @return + /// A NativeProcessProtocol shared pointer if the operation succeeded or + /// an error object if it failed. + //------------------------------------------------------------------ + virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>> + Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, + MainLoop &mainloop) const = 0; + + //------------------------------------------------------------------ + /// Attach to an existing process. + /// + /// @param[in] pid + /// pid of the process locatable + /// + /// @param[in] native_delegate + /// The delegate that will receive messages regarding the + /// inferior. Must outlive the NativeProcessProtocol + /// instance. + /// + /// @param[in] mainloop + /// The mainloop instance with which the process can register + /// callbacks. Must outlive the NativeProcessProtocol + /// instance. + /// + /// @return + /// A NativeProcessProtocol shared pointer if the operation succeeded or + /// an error object if it failed. + //------------------------------------------------------------------ + virtual llvm::Expected<std::unique_ptr<NativeProcessProtocol>> + Attach(lldb::pid_t pid, NativeDelegate &native_delegate, + MainLoop &mainloop) const = 0; + }; //------------------------------------------------------------------ - /// Launch a process for debugging. This method will create an concrete - /// instance of NativeProcessProtocol, based on the host platform. - /// (e.g. NativeProcessLinux on linux, etc.) + /// StartTracing API for starting a tracing instance with the + /// TraceOptions on a specific thread or process. /// - /// @param[in] launch_info - /// Information required to launch the process. + /// @param[in] config + /// The configuration to use when starting tracing. /// - /// @param[in] native_delegate - /// The delegate that will receive messages regarding the - /// inferior. Must outlive the NativeProcessProtocol - /// instance. + /// @param[out] error + /// Status indicates what went wrong. /// - /// @param[in] mainloop - /// The mainloop instance with which the process can register - /// callbacks. Must outlive the NativeProcessProtocol - /// instance. + /// @return + /// The API returns a user_id which can be used to get trace + /// data, trace configuration or stopping the trace instance. + /// The user_id is a key to identify and operate with a tracing + /// instance. It may refer to the complete process or a single + /// thread. + //------------------------------------------------------------------ + virtual lldb::user_id_t StartTrace(const TraceOptions &config, + Status &error) { + error.SetErrorString("Not implemented"); + return LLDB_INVALID_UID; + } + + //------------------------------------------------------------------ + /// StopTracing API as the name suggests stops a tracing instance. + /// + /// @param[in] traceid + /// The user id of the trace intended to be stopped. Now a + /// user_id may map to multiple threads in which case this API + /// could be used to stop the tracing for a specific thread by + /// supplying its thread id. /// - /// @param[out] process_sp - /// On successful return from the method, this parameter - /// contains the shared pointer to the - /// NativeProcessProtocol that can be used to manipulate - /// the native process. + /// @param[in] thread + /// Thread is needed when the complete process is being traced + /// and the user wishes to stop tracing on a particular thread. /// /// @return - /// An error object indicating if the operation succeeded, - /// and if not, what error occurred. + /// Status indicating what went wrong. //------------------------------------------------------------------ - static Error Launch(ProcessLaunchInfo &launch_info, - NativeDelegate &native_delegate, MainLoop &mainloop, - NativeProcessProtocolSP &process_sp); + virtual Status StopTrace(lldb::user_id_t traceid, + lldb::tid_t thread = LLDB_INVALID_THREAD_ID) { + return Status("Not implemented"); + } //------------------------------------------------------------------ - /// Attach to an existing process. This method will create an concrete - /// instance of NativeProcessProtocol, based on the host platform. - /// (e.g. NativeProcessLinux on linux, etc.) + /// This API provides the trace data collected in the form of raw + /// data. /// - /// @param[in] pid - /// pid of the process locatable - /// - /// @param[in] native_delegate - /// The delegate that will receive messages regarding the - /// inferior. Must outlive the NativeProcessProtocol + /// @param[in] traceid thread + /// The traceid and thread provide the context for the trace /// instance. /// - /// @param[in] mainloop - /// The mainloop instance with which the process can register - /// callbacks. Must outlive the NativeProcessProtocol - /// instance. + /// @param[in] buffer + /// The buffer provides the destination buffer where the trace + /// data would be read to. The buffer should be truncated to the + /// filled length by this function. /// - /// @param[out] process_sp - /// On successful return from the method, this parameter - /// contains the shared pointer to the - /// NativeProcessProtocol that can be used to manipulate - /// the native process. + /// @param[in] offset + /// There is possibility to read partially the trace data from + /// a specified offset where in such cases the buffer provided + /// may be smaller than the internal trace collection container. /// /// @return - /// An error object indicating if the operation succeeded, - /// and if not, what error occurred. + /// The size of the data actually read. //------------------------------------------------------------------ - static Error Attach(lldb::pid_t pid, NativeDelegate &native_delegate, - MainLoop &mainloop, NativeProcessProtocolSP &process_sp); + virtual Status GetData(lldb::user_id_t traceid, lldb::tid_t thread, + llvm::MutableArrayRef<uint8_t> &buffer, + size_t offset = 0) { + return Status("Not implemented"); + } + + //------------------------------------------------------------------ + /// Similar API as above except it aims to provide any extra data + /// useful for decoding the actual trace data. + //------------------------------------------------------------------ + virtual Status GetMetaData(lldb::user_id_t traceid, lldb::tid_t thread, + llvm::MutableArrayRef<uint8_t> &buffer, + size_t offset = 0) { + return Status("Not implemented"); + } + + //------------------------------------------------------------------ + /// API to query the TraceOptions for a given user id + /// + /// @param[in] traceid + /// The user id of the tracing instance. + /// + /// @param[in] config + /// The thread id of the tracing instance, in case configuration + /// for a specific thread is needed should be specified in the + /// config. + /// + /// @param[out] error + /// Status indicates what went wrong. + /// + /// @param[out] config + /// The actual configuration being used for tracing. + //------------------------------------------------------------------ + virtual Status GetTraceConfig(lldb::user_id_t traceid, TraceOptions &config) { + return Status("Not implemented"); + } protected: lldb::pid_t m_pid; std::vector<NativeThreadProtocolSP> m_threads; - lldb::tid_t m_current_thread_id; + lldb::tid_t m_current_thread_id = LLDB_INVALID_THREAD_ID; mutable std::recursive_mutex m_threads_mutex; - lldb::StateType m_state; + lldb::StateType m_state = lldb::eStateInvalid; mutable std::recursive_mutex m_state_mutex; - lldb_private::ExitType m_exit_type; - int m_exit_status; - std::string m_exit_description; + llvm::Optional<WaitStatus> m_exit_status; + std::recursive_mutex m_delegates_mutex; std::vector<NativeDelegate *> m_delegates; NativeBreakpointList m_breakpoint_list; NativeWatchpointList m_watchpoint_list; + HardwareBreakpointMap m_hw_breakpoints_map; int m_terminal_fd; - uint32_t m_stop_id; + uint32_t m_stop_id = 0; + + // Set of signal numbers that LLDB directly injects back to inferior + // without stopping it. + llvm::DenseSet<int> m_signals_to_ignore; // lldb_private::Host calls should be used to launch a process for debugging, // and // then the process should be attached to. When attaching to a process // lldb_private::Host calls should be used to locate the process to attach to, // and then this function should be called. - NativeProcessProtocol(lldb::pid_t pid); + NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, + NativeDelegate &delegate); // ----------------------------------------------------------- // Internal interface for state handling @@ -331,9 +446,9 @@ protected: // ----------------------------------------------------------- // Internal interface for software breakpoints // ----------------------------------------------------------- - Error SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint); + Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint); - virtual Error + virtual Status GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) = 0; @@ -351,11 +466,11 @@ protected: // ----------------------------------------------------------- // Static helper methods for derived classes. // ----------------------------------------------------------- - static Error ResolveProcessArchitecture(lldb::pid_t pid, ArchSpec &arch); + static Status ResolveProcessArchitecture(lldb::pid_t pid, ArchSpec &arch); private: void SynchronouslyNotifyProcessStateChanged(lldb::StateType state); }; -} +} // namespace lldb_private #endif // #ifndef liblldb_NativeProcessProtocol_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeRegisterContext.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeRegisterContext.h index dd583d7..982d81b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeRegisterContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeRegisterContext.h @@ -53,15 +53,15 @@ public: virtual const RegisterSet *GetRegisterSet(uint32_t set_index) const = 0; - virtual Error ReadRegister(const RegisterInfo *reg_info, - RegisterValue ®_value) = 0; + virtual Status ReadRegister(const RegisterInfo *reg_info, + RegisterValue ®_value) = 0; - virtual Error WriteRegister(const RegisterInfo *reg_info, - const RegisterValue ®_value) = 0; + virtual Status WriteRegister(const RegisterInfo *reg_info, + const RegisterValue ®_value) = 0; - virtual Error ReadAllRegisterValues(lldb::DataBufferSP &data_sp) = 0; + virtual Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) = 0; - virtual Error WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) = 0; + virtual Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) = 0; uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const; @@ -75,6 +75,11 @@ public: virtual bool ClearHardwareBreakpoint(uint32_t hw_idx); + virtual Status ClearAllHardwareBreakpoints(); + + virtual Status GetHardwareBreakHitIndex(uint32_t &bp_index, + lldb::addr_t trap_addr); + virtual uint32_t NumSupportedHardwareWatchpoints(); virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, @@ -82,14 +87,14 @@ public: virtual bool ClearHardwareWatchpoint(uint32_t hw_index); - virtual Error ClearAllHardwareWatchpoints(); + virtual Status ClearAllHardwareWatchpoints(); - virtual Error IsWatchpointHit(uint32_t wp_index, bool &is_hit); + virtual Status IsWatchpointHit(uint32_t wp_index, bool &is_hit); - virtual Error GetWatchpointHitIndex(uint32_t &wp_index, - lldb::addr_t trap_addr); + virtual Status GetWatchpointHitIndex(uint32_t &wp_index, + lldb::addr_t trap_addr); - virtual Error IsWatchpointVacant(uint32_t wp_index, bool &is_vacant); + virtual Status IsWatchpointVacant(uint32_t wp_index, bool &is_vacant); virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index); @@ -109,12 +114,12 @@ public: virtual bool HardwareSingleStep(bool enable); - virtual Error + virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, size_t src_len, RegisterValue ®_value); - virtual Error + virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value); @@ -136,15 +141,15 @@ public: virtual lldb::addr_t GetPCfromBreakpointLocation(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS); - Error SetPC(lldb::addr_t pc); + Status SetPC(lldb::addr_t pc); lldb::addr_t GetSP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS); - Error SetSP(lldb::addr_t sp); + Status SetSP(lldb::addr_t sp); lldb::addr_t GetFP(lldb::addr_t fail_value = LLDB_INVALID_ADDRESS); - Error SetFP(lldb::addr_t fp); + Status SetFP(lldb::addr_t fp); const char *GetRegisterName(uint32_t reg); @@ -157,9 +162,9 @@ public: lldb::addr_t ReadRegisterAsUnsigned(const RegisterInfo *reg_info, lldb::addr_t fail_value); - Error WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval); + Status WriteRegisterFromUnsigned(uint32_t reg, uint64_t uval); - Error WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval); + Status WriteRegisterFromUnsigned(const RegisterInfo *reg_info, uint64_t uval); // uint32_t // GetStopID () const diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h deleted file mode 100644 index 908989a..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeRegisterContextRegisterInfo.h +++ /dev/null @@ -1,42 +0,0 @@ -//===-- NativeRegisterContextRegisterInfo.h ----------------------*- C++ -//-*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_NativeRegisterContextRegisterInfo_h -#define lldb_NativeRegisterContextRegisterInfo_h - -#include <memory> - -#include "NativeRegisterContext.h" -#include "Plugins/Process/Utility/RegisterInfoInterface.h" - -namespace lldb_private { -class NativeRegisterContextRegisterInfo : public NativeRegisterContext { -public: - /// - /// Construct a NativeRegisterContextRegisterInfo, taking ownership - /// of the register_info_interface pointer. - /// - NativeRegisterContextRegisterInfo( - NativeThreadProtocol &thread, uint32_t concrete_frame_idx, - RegisterInfoInterface *register_info_interface); - - uint32_t GetRegisterCount() const override; - - uint32_t GetUserRegisterCount() const override; - - const RegisterInfo *GetRegisterInfoAtIndex(uint32_t reg_index) const override; - - const RegisterInfoInterface &GetRegisterInfoInterface() const; - -private: - std::unique_ptr<RegisterInfoInterface> m_register_info_interface_up; -}; -} -#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeThreadProtocol.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeThreadProtocol.h index 450e746..d96f713 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeThreadProtocol.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeThreadProtocol.h @@ -23,7 +23,7 @@ namespace lldb_private { class NativeThreadProtocol : public std::enable_shared_from_this<NativeThreadProtocol> { public: - NativeThreadProtocol(NativeProcessProtocol *process, lldb::tid_t tid); + NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid); virtual ~NativeThreadProtocol() {} @@ -33,31 +33,38 @@ public: virtual NativeRegisterContextSP GetRegisterContext() = 0; - virtual Error ReadRegister(uint32_t reg, RegisterValue ®_value); + virtual Status ReadRegister(uint32_t reg, RegisterValue ®_value); - virtual Error WriteRegister(uint32_t reg, const RegisterValue ®_value); + virtual Status WriteRegister(uint32_t reg, const RegisterValue ®_value); - virtual Error SaveAllRegisters(lldb::DataBufferSP &data_sp); + virtual Status SaveAllRegisters(lldb::DataBufferSP &data_sp); - virtual Error RestoreAllRegisters(lldb::DataBufferSP &data_sp); + virtual Status RestoreAllRegisters(lldb::DataBufferSP &data_sp); virtual bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) = 0; lldb::tid_t GetID() const { return m_tid; } - NativeProcessProtocolSP GetProcess(); + NativeProcessProtocol &GetProcess() { return m_process; } // --------------------------------------------------------------------- // Thread-specific watchpoints // --------------------------------------------------------------------- - virtual Error SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware) = 0; + virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware) = 0; - virtual Error RemoveWatchpoint(lldb::addr_t addr) = 0; + virtual Status RemoveWatchpoint(lldb::addr_t addr) = 0; + + // --------------------------------------------------------------------- + // Thread-specific Hardware Breakpoint routines + // --------------------------------------------------------------------- + virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0; + + virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0; protected: - NativeProcessProtocolWP m_process_wp; + NativeProcessProtocol &m_process; lldb::tid_t m_tid; }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeWatchpointList.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeWatchpointList.h index 2424e56..02920e6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeWatchpointList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/NativeWatchpointList.h @@ -10,7 +10,7 @@ #ifndef liblldb_NativeWatchpointList_h_ #define liblldb_NativeWatchpointList_h_ -#include "lldb/Core/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-forward.h" #include <map> @@ -25,10 +25,10 @@ struct NativeWatchpoint { class NativeWatchpointList { public: - Error Add(lldb::addr_t addr, size_t size, uint32_t watch_flags, - bool hardware); + Status Add(lldb::addr_t addr, size_t size, uint32_t watch_flags, + bool hardware); - Error Remove(lldb::addr_t addr); + Status Remove(lldb::addr_t addr); using WatchpointMap = std::map<lldb::addr_t, NativeWatchpoint>; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/SoftwareBreakpoint.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/SoftwareBreakpoint.h index 703f6bb..e0f235f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/SoftwareBreakpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/SoftwareBreakpoint.h @@ -18,18 +18,18 @@ class SoftwareBreakpoint : public NativeBreakpoint { friend class NativeBreakpointList; public: - static Error CreateSoftwareBreakpoint(NativeProcessProtocol &process, - lldb::addr_t addr, size_t size_hint, - NativeBreakpointSP &breakpoint_spn); + static Status CreateSoftwareBreakpoint(NativeProcessProtocol &process, + lldb::addr_t addr, size_t size_hint, + NativeBreakpointSP &breakpoint_spn); SoftwareBreakpoint(NativeProcessProtocol &process, lldb::addr_t addr, const uint8_t *saved_opcodes, const uint8_t *trap_opcodes, size_t opcode_size); protected: - Error DoEnable() override; + Status DoEnable() override; - Error DoDisable() override; + Status DoDisable() override; bool IsSoftwareBreakpoint() const override; @@ -42,11 +42,11 @@ private: uint8_t m_trap_opcodes[MAX_TRAP_OPCODE_SIZE]; const size_t m_opcode_size; - static Error EnableSoftwareBreakpoint(NativeProcessProtocol &process, - lldb::addr_t addr, - size_t bp_opcode_size, - const uint8_t *bp_opcode_bytes, - uint8_t *saved_opcode_bytes); + static Status EnableSoftwareBreakpoint(NativeProcessProtocol &process, + lldb::addr_t addr, + size_t bp_opcode_size, + const uint8_t *bp_opcode_bytes, + uint8_t *saved_opcode_bytes); }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/TCPSocket.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/TCPSocket.h index 2ce8d82..0d32a70 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/TCPSocket.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/TCPSocket.h @@ -11,12 +11,16 @@ #define liblldb_TCPSocket_h_ #include "lldb/Host/Socket.h" +#include "lldb/Host/SocketAddress.h" +#include <map> namespace lldb_private { class TCPSocket : public Socket { public: - TCPSocket(NativeSocket socket, bool should_close); - TCPSocket(bool child_processes_inherit, Error &error); + TCPSocket(bool should_close, bool child_processes_inherit); + TCPSocket(NativeSocket socket, bool should_close, + bool child_processes_inherit); + ~TCPSocket() override; // returns port number or 0 if error uint16_t GetLocalPortNumber() const; @@ -35,10 +39,20 @@ public: int SetOptionNoDelay(); int SetOptionReuseAddress(); - Error Connect(llvm::StringRef name) override; - Error Listen(llvm::StringRef name, int backlog) override; - Error Accept(llvm::StringRef name, bool child_processes_inherit, - Socket *&conn_socket) override; + Status Connect(llvm::StringRef name) override; + Status Listen(llvm::StringRef name, int backlog) override; + Status Accept(Socket *&conn_socket) override; + + Status CreateSocket(int domain); + + bool IsValid() const override; + +private: + TCPSocket(NativeSocket socket, const TCPSocket &listen_socket); + + void CloseListenSockets(); + + std::map<int, SocketAddress> m_listen_sockets; }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/common/UDPSocket.h b/contrib/llvm/tools/lldb/include/lldb/Host/common/UDPSocket.h index 153804b..27b2d1d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/common/UDPSocket.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/common/UDPSocket.h @@ -15,21 +15,20 @@ namespace lldb_private { class UDPSocket : public Socket { public: - UDPSocket(bool child_processes_inherit, Error &error); + UDPSocket(bool should_close, bool child_processes_inherit); - static Error Connect(llvm::StringRef name, bool child_processes_inherit, - Socket *&send_socket, Socket *&recv_socket); + static Status Connect(llvm::StringRef name, bool child_processes_inherit, + Socket *&socket); private: UDPSocket(NativeSocket socket); size_t Send(const void *buf, const size_t num_bytes) override; - Error Connect(llvm::StringRef name) override; - Error Listen(llvm::StringRef name, int backlog) override; - Error Accept(llvm::StringRef name, bool child_processes_inherit, - Socket *&socket) override; + Status Connect(llvm::StringRef name) override; + Status Listen(llvm::StringRef name, int backlog) override; + Status Accept(Socket *&socket) override; - SocketAddress m_send_sockaddr; + SocketAddress m_sockaddr; }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/Config.h b/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/Config.h deleted file mode 100644 index 1e9f552..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/Config.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h b/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h index a549f87..945ec83 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h @@ -10,14 +10,13 @@ #ifndef lldb_Host_freebsd_HostInfoFreeBSD_h_ #define lldb_Host_freebsd_HostInfoFreeBSD_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { class HostInfoFreeBSD : public HostInfoPosix { public: - static uint32_t GetMaxThreadNameLength(); static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); static bool GetOSBuildString(std::string &s); static bool GetOSKernelDescription(std::string &s); diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/HostThreadFreeBSD.h b/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/HostThreadFreeBSD.h deleted file mode 100644 index 2f1d6ce..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/freebsd/HostThreadFreeBSD.h +++ /dev/null @@ -1,29 +0,0 @@ -//===-- HostThreadFreeBSD.h -------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_freebsd_HostThreadFreeBSD_h_ -#define lldb_Host_freebsd_HostThreadFreeBSD_h_ - -#include "lldb/Host/posix/HostThreadPosix.h" - -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringRef.h" - -namespace lldb_private { - -class HostThreadFreeBSD : public HostThreadPosix { -public: - HostThreadFreeBSD(); - HostThreadFreeBSD(lldb::thread_t thread); - - static void GetName(lldb::tid_t tid, llvm::SmallVectorImpl<char> &name); -}; -} - -#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/Config.h b/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/Config.h deleted file mode 100644 index 1e9f552..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/Config.h +++ /dev/null @@ -1,28 +0,0 @@ -//===-- Config.h -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -//---------------------------------------------------------------------- -// LLDB currently doesn't have a dynamic configuration mechanism, so we -// are going to hardcode things for now. Eventually these files will -// be auto generated by some configuration script that can detect -// platform functionality availability. -//---------------------------------------------------------------------- - -#ifndef liblldb_Platform_Config_h_ -#define liblldb_Platform_Config_h_ - -#define LLDB_CONFIG_TERMIOS_SUPPORTED 1 - -#define LLDB_CONFIG_TILDE_RESOLVES_TO_USER 1 - -//#define LLDB_CONFIG_DLOPEN_RTLD_FIRST_SUPPORTED 1 - -//#define LLDB_CONFIG_FCNTL_GETPATH_SUPPORTED 1 - -#endif // #ifndef liblldb_Platform_Config_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h b/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h index 684e54e..9ebff6b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h @@ -10,14 +10,13 @@ #ifndef lldb_Host_netbsd_HostInfoNetBSD_h_ #define lldb_Host_netbsd_HostInfoNetBSD_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { class HostInfoNetBSD : public HostInfoPosix { public: - static uint32_t GetMaxThreadNameLength(); static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); static bool GetOSBuildString(std::string &s); static bool GetOSKernelDescription(std::string &s); diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/HostThreadNetBSD.h b/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/HostThreadNetBSD.h deleted file mode 100644 index 385f014..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/netbsd/HostThreadNetBSD.h +++ /dev/null @@ -1,30 +0,0 @@ -//===-- HostThreadNetBSD.h -------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_netbsd_HostThreadNetBSD_h_ -#define lldb_Host_netbsd_HostThreadNetBSD_h_ - -#include "lldb/Host/posix/HostThreadPosix.h" - -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/StringRef.h" - -namespace lldb_private { - -class HostThreadNetBSD : public HostThreadPosix { -public: - HostThreadNetBSD(); - HostThreadNetBSD(lldb::thread_t thread); - - static void SetName(lldb::thread_t tid, llvm::StringRef &name); - static void GetName(lldb::thread_t tid, llvm::SmallVectorImpl<char> &name); -}; -} - -#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h b/contrib/llvm/tools/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h new file mode 100644 index 0000000..5a0388f --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h @@ -0,0 +1,27 @@ +//===-- HostInfoOpenBSD.h --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_Host_openbsd_HostInfoOpenBSD_h_ +#define lldb_Host_openbsd_HostInfoOpenBSD_h_ + +#include "lldb/Host/posix/HostInfoPosix.h" +#include "lldb/Utility/FileSpec.h" + +namespace lldb_private { + +class HostInfoOpenBSD : public HostInfoPosix { +public: + static bool GetOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update); + static bool GetOSBuildString(std::string &s); + static bool GetOSKernelDescription(std::string &s); + static FileSpec GetProgramFileSpec(); +}; +} + +#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h index f002dd1..b7e08eb 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -19,14 +19,14 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Connection.h" -#include "lldb/Host/IOObject.h" #include "lldb/Host/Pipe.h" #include "lldb/Host/Predicate.h" +#include "lldb/Utility/Connection.h" +#include "lldb/Utility/IOObject.h" namespace lldb_private { -class Error; +class Status; class Socket; class SocketAddress; @@ -53,20 +53,20 @@ public: bool IsConnected() const override; - lldb::ConnectionStatus Connect(llvm::StringRef s, Error *error_ptr) override; + lldb::ConnectionStatus Connect(llvm::StringRef s, Status *error_ptr) override; - lldb::ConnectionStatus Disconnect(Error *error_ptr) override; + lldb::ConnectionStatus Disconnect(Status *error_ptr) override; size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr) override; + lldb::ConnectionStatus &status, Status *error_ptr) override; size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, - Error *error_ptr) override; + Status *error_ptr) override; std::string GetURI() override; lldb::ConnectionStatus BytesAvailable(const Timeout<std::micro> &timeout, - Error *error_ptr); + Status *error_ptr); bool InterruptRead() override; @@ -83,21 +83,21 @@ protected: void CloseCommandPipe(); lldb::ConnectionStatus SocketListenAndAccept(llvm::StringRef host_and_port, - Error *error_ptr); + Status *error_ptr); lldb::ConnectionStatus ConnectTCP(llvm::StringRef host_and_port, - Error *error_ptr); + Status *error_ptr); - lldb::ConnectionStatus ConnectUDP(llvm::StringRef args, Error *error_ptr); + lldb::ConnectionStatus ConnectUDP(llvm::StringRef args, Status *error_ptr); lldb::ConnectionStatus NamedSocketConnect(llvm::StringRef socket_name, - Error *error_ptr); + Status *error_ptr); lldb::ConnectionStatus NamedSocketAccept(llvm::StringRef socket_name, - Error *error_ptr); + Status *error_ptr); lldb::ConnectionStatus UnixAbstractSocketConnect(llvm::StringRef socket_name, - Error *error_ptr); + Status *error_ptr); lldb::IOObjectSP m_read_sp; lldb::IOObjectSP m_write_sp; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/DomainSocket.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/DomainSocket.h index 3bd4e01..e66b3f9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/DomainSocket.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/DomainSocket.h @@ -15,22 +15,20 @@ namespace lldb_private { class DomainSocket : public Socket { public: - DomainSocket(bool child_processes_inherit, Error &error); + DomainSocket(bool should_close, bool child_processes_inherit); - Error Connect(llvm::StringRef name) override; - Error Listen(llvm::StringRef name, int backlog) override; - Error Accept(llvm::StringRef name, bool child_processes_inherit, - Socket *&socket) override; + Status Connect(llvm::StringRef name) override; + Status Listen(llvm::StringRef name, int backlog) override; + Status Accept(Socket *&socket) override; protected: - DomainSocket(SocketProtocol protocol, bool child_processes_inherit, - Error &error); + DomainSocket(SocketProtocol protocol, bool child_processes_inherit); virtual size_t GetNameOffset() const; virtual void DeleteSocketFile(llvm::StringRef name); private: - DomainSocket(NativeSocket socket); + DomainSocket(NativeSocket socket, const DomainSocket &listen_socket); }; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostInfoPosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostInfoPosix.h index 6d22776..34994ae 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostInfoPosix.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostInfoPosix.h @@ -10,8 +10,8 @@ #ifndef lldb_Host_posix_HostInfoPosix_h_ #define lldb_Host_posix_HostInfoPosix_h_ -#include "lldb/Host/FileSpec.h" #include "lldb/Host/HostInfoBase.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostProcessPosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostProcessPosix.h index 1535e67..0a6d882 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostProcessPosix.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostProcessPosix.h @@ -14,8 +14,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/Host/HostNativeProcessBase.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-types.h" namespace lldb_private { @@ -28,11 +28,11 @@ public: HostProcessPosix(lldb::process_t process); ~HostProcessPosix() override; - virtual Error Signal(int signo) const; - static Error Signal(lldb::process_t process, int signo); + virtual Status Signal(int signo) const; + static Status Signal(lldb::process_t process, int signo); - Error Terminate() override; - Error GetMainModule(FileSpec &file_spec) const override; + Status Terminate() override; + Status GetMainModule(FileSpec &file_spec) const override; lldb::pid_t GetProcessId() const override; bool IsRunning() const override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostThreadPosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostThreadPosix.h index 99b99d7..c230a61 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostThreadPosix.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/HostThreadPosix.h @@ -22,10 +22,10 @@ public: HostThreadPosix(lldb::thread_t thread); ~HostThreadPosix() override; - Error Join(lldb::thread_result_t *result) override; - Error Cancel() override; + Status Join(lldb::thread_result_t *result) override; + Status Cancel() override; - Error Detach(); + Status Detach(); }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/LockFilePosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/LockFilePosix.h index dde9bd0..a59a7fe 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/LockFilePosix.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/LockFilePosix.h @@ -20,15 +20,15 @@ public: ~LockFilePosix() override; protected: - Error DoWriteLock(const uint64_t start, const uint64_t len) override; + Status DoWriteLock(const uint64_t start, const uint64_t len) override; - Error DoTryWriteLock(const uint64_t start, const uint64_t len) override; + Status DoTryWriteLock(const uint64_t start, const uint64_t len) override; - Error DoReadLock(const uint64_t start, const uint64_t len) override; + Status DoReadLock(const uint64_t start, const uint64_t len) override; - Error DoTryReadLock(const uint64_t start, const uint64_t len) override; + Status DoTryReadLock(const uint64_t start, const uint64_t len) override; - Error DoUnlock() override; + Status DoUnlock() override; }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/MainLoopPosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/MainLoopPosix.h deleted file mode 100644 index 21e02be..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/MainLoopPosix.h +++ /dev/null @@ -1,104 +0,0 @@ -//===-- MainLoopPosix.h -----------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_Host_posix_MainLoopPosix_h_ -#define lldb_Host_posix_MainLoopPosix_h_ - -#include "lldb/Host/MainLoopBase.h" - -#include "llvm/ADT/DenseMap.h" - -namespace lldb_private { - -// Posix implementation of the MainLoopBase class. It can monitor file -// descriptors for -// readability using pselect. In addition to the common base, this class -// provides the ability to -// invoke a given handler when a signal is received. -// -// Since this class is primarily intended to be used for single-threaded -// processing, it does not -// attempt to perform any internal synchronisation and any concurrent accesses -// must be protected -// externally. However, it is perfectly legitimate to have more than one -// instance of this class -// running on separate threads, or even a single thread (with some limitations -// on signal -// monitoring). -// TODO: Add locking if this class is to be used in a multi-threaded context. -class MainLoopPosix : public MainLoopBase { -private: - class SignalHandle; - -public: - typedef std::unique_ptr<SignalHandle> SignalHandleUP; - - ~MainLoopPosix() override; - - ReadHandleUP RegisterReadObject(const lldb::IOObjectSP &object_sp, - const Callback &callback, - Error &error) override; - - // Listening for signals from multiple MainLoopPosix instances is perfectly - // safe as long as they - // don't try to listen for the same signal. The callback function is invoked - // when the control - // returns to the Run() function, not when the hander is executed. This means - // that you can - // treat the callback as a normal function and perform things which would not - // be safe in a - // signal handler. However, since the callback is not invoked synchronously, - // you cannot use - // this mechanism to handle SIGSEGV and the like. - SignalHandleUP RegisterSignal(int signo, const Callback &callback, - Error &error); - - Error Run() override; - - // This should only be performed from a callback. Do not attempt to terminate - // the processing - // from another thread. - // TODO: Add synchronization if we want to be terminated from another thread. - void RequestTermination() override { m_terminate_request = true; } - -protected: - void UnregisterReadObject(IOObject::WaitableHandle handle) override; - - void UnregisterSignal(int signo); - -private: - class SignalHandle { - public: - ~SignalHandle() { m_mainloop.UnregisterSignal(m_signo); } - - private: - SignalHandle(MainLoopPosix &mainloop, int signo) - : m_mainloop(mainloop), m_signo(signo) {} - - MainLoopPosix &m_mainloop; - int m_signo; - - friend class MainLoopPosix; - DISALLOW_COPY_AND_ASSIGN(SignalHandle); - }; - - struct SignalInfo { - Callback callback; - struct sigaction old_action; - bool was_blocked : 1; - }; - - llvm::DenseMap<IOObject::WaitableHandle, Callback> m_read_fds; - llvm::DenseMap<int, SignalInfo> m_signals; - bool m_terminate_request : 1; -}; - -} // namespace lldb_private - -#endif // lldb_Host_posix_MainLoopPosix_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/PipePosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/PipePosix.h index 738f95e..8208b1b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/PipePosix.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/PipePosix.h @@ -35,12 +35,14 @@ public: ~PipePosix() override; - Error CreateNew(bool child_process_inherit) override; - Error CreateNew(llvm::StringRef name, bool child_process_inherit) override; - Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, - llvm::SmallVectorImpl<char> &name) override; - Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) override; - Error + Status CreateNew(bool child_process_inherit) override; + Status CreateNew(llvm::StringRef name, bool child_process_inherit) override; + Status CreateWithUniqueName(llvm::StringRef prefix, + bool child_process_inherit, + llvm::SmallVectorImpl<char> &name) override; + Status OpenAsReader(llvm::StringRef name, + bool child_process_inherit) override; + Status OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override; @@ -57,12 +59,12 @@ public: // Close both descriptors void Close() override; - Error Delete(llvm::StringRef name) override; + Status Delete(llvm::StringRef name) override; - Error Write(const void *buf, size_t size, size_t &bytes_written) override; - Error ReadWithTimeout(void *buf, size_t size, - const std::chrono::microseconds &timeout, - size_t &bytes_read) override; + Status Write(const void *buf, size_t size, size_t &bytes_written) override; + Status ReadWithTimeout(void *buf, size_t size, + const std::chrono::microseconds &timeout, + size_t &bytes_read) override; private: int m_fds[2]; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/posix/ProcessLauncherPosix.h b/contrib/llvm/tools/lldb/include/lldb/Host/posix/ProcessLauncherPosixFork.h index e481e3d..1193a20 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/posix/ProcessLauncherPosix.h +++ b/contrib/llvm/tools/lldb/include/lldb/Host/posix/ProcessLauncherPosixFork.h @@ -1,4 +1,4 @@ -//===-- ProcessLauncherPosix.h ----------------------------------*- C++ -*-===// +//===-- ProcessLauncherPosixFork.h ------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,18 +7,19 @@ // //===----------------------------------------------------------------------===// -#ifndef lldb_Host_posix_ProcessLauncherPosix_h_ -#define lldb_Host_posix_ProcessLauncherPosix_h_ +#ifndef lldb_Host_posix_ProcessLauncherPosixFork_h_ +#define lldb_Host_posix_ProcessLauncherPosixFork_h_ #include "lldb/Host/ProcessLauncher.h" namespace lldb_private { -class ProcessLauncherPosix : public ProcessLauncher { +class ProcessLauncherPosixFork : public ProcessLauncher { public: HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, - Error &error) override; + Status &error) override; }; -} + +} // end of namespace lldb_private #endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/Args.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/Args.h index 6610be1..98046cd 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/Args.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/Args.h @@ -21,13 +21,14 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" // Project includes -#include "lldb/Core/Error.h" -#include "lldb/Host/OptionParser.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private-types.h" #include "lldb/lldb-types.h" namespace lldb_private { +struct Option; + typedef std::vector<std::tuple<std::string, int, std::string>> OptionArgVector; typedef std::shared_ptr<OptionArgVector> OptionArgVectorSP; @@ -193,6 +194,15 @@ public: const char **GetConstArgumentVector() const; //------------------------------------------------------------------ + /// Gets the argument as an ArrayRef. Note that the return value does *not* + /// have a nullptr const char * at the end, as the size of the list is + /// embedded in the ArrayRef object. + //------------------------------------------------------------------ + llvm::ArrayRef<const char *> GetArgumentArrayRef() const { + return llvm::makeArrayRef(m_argv).drop_back(); + } + + //------------------------------------------------------------------ /// Appends a new argument to the end of the list argument list. /// /// @param[in] arg_cstr @@ -312,8 +322,8 @@ public: /// /// @see class Options //------------------------------------------------------------------ - Error ParseOptions(Options &options, ExecutionContext *execution_context, - lldb::PlatformSP platform_sp, bool require_validation); + Status ParseOptions(Options &options, ExecutionContext *execution_context, + lldb::PlatformSP platform_sp, bool require_validation); bool IsPositionalArgument(const char *arg); @@ -367,7 +377,7 @@ public: static lldb::addr_t StringToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, - lldb::addr_t fail_value, Error *error); + lldb::addr_t fail_value, Status *error); static bool StringToBoolean(llvm::StringRef s, bool fail_value, bool *success_ptr); @@ -377,17 +387,17 @@ public: static int64_t StringToOptionEnum(llvm::StringRef s, OptionEnumValueElement *enum_values, - int32_t fail_value, Error &error); + int32_t fail_value, Status &error); static lldb::ScriptLanguage StringToScriptLanguage(llvm::StringRef s, lldb::ScriptLanguage fail_value, bool *success_ptr); // TODO: Use StringRef - static Error StringToFormat(const char *s, lldb::Format &format, - size_t *byte_size_ptr); // If non-NULL, then a - // byte size can precede - // the format character + static Status StringToFormat(const char *s, lldb::Format &format, + size_t *byte_size_ptr); // If non-NULL, then a + // byte size can precede + // the format character static lldb::Encoding StringToEncoding(llvm::StringRef s, diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandCompletions.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandCompletions.h index 2e11735..8bac3e8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandCompletions.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandCompletions.h @@ -17,11 +17,14 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/FileSpecList.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/SearchFilter.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/lldb-private.h" +#include "llvm/ADT/Twine.h" + namespace lldb_private { +class TildeExpressionResolver; class CommandCompletions { public: //---------------------------------------------------------------------- @@ -76,12 +79,19 @@ public: int max_return_elements, SearchFilter *searcher, bool &word_complete, StringList &matches); + static int DiskFiles(const llvm::Twine &partial_file_name, + StringList &matches, TildeExpressionResolver &Resolver); + static int DiskDirectories(CommandInterpreter &interpreter, llvm::StringRef partial_file_name, int match_start_point, int max_return_elements, SearchFilter *searcher, bool &word_complete, StringList &matches); + static int DiskDirectories(const llvm::Twine &partial_file_name, + StringList &matches, + TildeExpressionResolver &Resolver); + static int SourceFiles(CommandInterpreter &interpreter, llvm::StringRef partial_file_name, int match_start_point, int max_return_elements, diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandHistory.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandHistory.h index f1a6c85..faef220 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandHistory.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandHistory.h @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandInterpreter.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandInterpreter.h index 00dec51..73bd7d6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -19,13 +19,13 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Event.h" #include "lldb/Core/IOHandler.h" -#include "lldb/Core/Log.h" -#include "lldb/Core/StringList.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandAlias.h" #include "lldb/Interpreter/CommandHistory.h" #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/ScriptInterpreter.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" @@ -510,7 +510,7 @@ protected: StringList *matches = nullptr) const; private: - Error PreprocessCommand(std::string &command); + Status PreprocessCommand(std::string &command); // Completely resolves aliases and abbreviations, returning a pointer to the // final command object and updating command_line to the fully substituted @@ -539,7 +539,7 @@ private: std::string m_repeat_command; // Stores the command that will be executed for // an empty command string. lldb::ScriptInterpreterSP m_script_interpreter_sp; - std::mutex m_script_interpreter_mutex; + std::recursive_mutex m_script_interpreter_mutex; lldb::IOHandlerSP m_command_io_handler_sp; char m_comment_char; bool m_batch_command_mode; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObject.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObject.h index 9104fd8..ff4c829 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObject.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObject.h @@ -18,11 +18,12 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Flags.h" -#include "lldb/Core/StringList.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Target/ExecutionContext.h" +#include "lldb/Utility/StringList.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h index 44dc4f2..50dbebc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandObjectRegexCommand.h @@ -16,8 +16,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/RegularExpression.h" #include "lldb/Interpreter/CommandObject.h" +#include "lldb/Utility/RegularExpression.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandReturnObject.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandReturnObject.h index 40db563..7b04c39 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandReturnObject.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/CommandReturnObject.h @@ -16,8 +16,8 @@ // Project includes #include "lldb/Core/STLUtils.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/StreamTee.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/Utility/StreamTee.h" #include "lldb/lldb-private.h" #include "llvm/ADT/StringRef.h" @@ -129,7 +129,7 @@ public: AppendError(llvm::formatv(format, std::forward<Args>(args)...).str()); } - void SetError(const Error &error, const char *fallback_error_cstr = nullptr); + void SetError(const Status &error, const char *fallback_error_cstr = nullptr); void SetError(llvm::StringRef error_cstr); diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h index 742cd6d..e73a534 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupArchitecture.h @@ -31,8 +31,8 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupBoolean.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupBoolean.h index 931a6d7..53d08d7 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupBoolean.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupBoolean.h @@ -38,9 +38,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFile.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFile.h index 93e3ed7..d0c25b8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFile.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFile.h @@ -37,9 +37,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; @@ -70,9 +70,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFormat.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFormat.h index f3a4203..ddf2cce 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFormat.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupFormat.h @@ -43,9 +43,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupOutputFile.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupOutputFile.h index cb891f0..19453c6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupOutputFile.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupOutputFile.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupPlatform.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupPlatform.h index c51ff5c..e796624 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupPlatform.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupPlatform.h @@ -14,8 +14,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { @@ -36,15 +36,15 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter, const ArchSpec &arch, - bool make_selected, Error &error, + bool make_selected, Status &error, ArchSpec &platform_arch) const; bool PlatformWasSpecified() const { return !m_platform_name.empty(); } diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupString.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupString.h index 21bfc08..01e8aa9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupString.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupString.h @@ -35,9 +35,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUInt64.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUInt64.h index 3f04eac..82eb0e2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUInt64.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUInt64.h @@ -36,9 +36,9 @@ public: return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1); } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUUID.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUUID.h index 9a7c6cf..def97d5 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUUID.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupUUID.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h index 694464b..0e07577 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupVariable.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupVariable.h index 0735de4..c9e9032 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupVariable.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupVariable.h @@ -31,9 +31,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h index c67c8f0..f266563 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h @@ -32,9 +32,9 @@ public: llvm::ArrayRef<OptionDefinition> GetDefinitions() override; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, - ExecutionContext *execution_context) override; - Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, + ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValue.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValue.h index 2c1d5df..6008e1e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValue.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValue.h @@ -14,10 +14,12 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" #include "lldb/Core/FormatEntity.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-defines.h" +#include "lldb/lldb-private-enumerations.h" +#include "lldb/lldb-private-interfaces.h" namespace lldb_private { @@ -89,7 +91,7 @@ public: virtual void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0; - virtual Error + virtual Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign); @@ -106,15 +108,16 @@ public: // Subclasses can override these functions //----------------------------------------------------------------- virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool will_modify, - Error &error) const { + llvm::StringRef name, + bool will_modify, + Status &error) const { error.SetErrorStringWithFormat("'%s' is not a value subvalue", name.str().c_str()); return lldb::OptionValueSP(); } - virtual Error SetSubValue(const ExecutionContext *exe_ctx, - VarSetOperationType op, llvm::StringRef name, - llvm::StringRef value); + virtual Status SetSubValue(const ExecutionContext *exe_ctx, + VarSetOperationType op, llvm::StringRef name, + llvm::StringRef value); virtual bool IsAggregateValue() const { return false; } @@ -178,7 +181,7 @@ public: static lldb::OptionValueSP CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask, - Error &error); + Status &error); // Get this value as a uint64_t value if it is encoded as a boolean, // uint64_t or int64_t. Other types will cause "fail_value" to be diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArch.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArch.h index aa54812..e1a354d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArch.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArch.h @@ -46,10 +46,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArray.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArray.h index 1e568ca..bbf4e37 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArray.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueArray.h @@ -36,10 +36,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; @@ -55,7 +55,7 @@ public: lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, bool will_modify, - Error &error) const override; + Status &error) const override; //--------------------------------------------------------------------- // Subclass specific functions @@ -122,7 +122,7 @@ public: size_t GetArgs(Args &args) const; - Error SetArgs(const Args &args, VarSetOperationType op); + Status SetArgs(const Args &args, VarSetOperationType op); protected: typedef std::vector<lldb::OptionValueSP> collection; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueBoolean.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueBoolean.h index d429c05..1ff84dd 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueBoolean.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueBoolean.h @@ -37,10 +37,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueChar.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueChar.h index d186447..0c5f602 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueChar.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueChar.h @@ -38,10 +38,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueDictionary.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueDictionary.h index 5d015a5..4e8c860 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueDictionary.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueDictionary.h @@ -38,7 +38,7 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; @@ -66,10 +66,10 @@ public: lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, bool will_modify, - Error &error) const override; + Status &error) const override; - Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, - llvm::StringRef name, llvm::StringRef value) override; + Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, + llvm::StringRef name, llvm::StringRef value) override; bool SetValueForKey(const ConstString &key, const lldb::OptionValueSP &value_sp, @@ -79,7 +79,7 @@ public: size_t GetArgs(Args &args) const; - Error SetArgs(const Args &args, VarSetOperationType op); + Status SetArgs(const Args &args, VarSetOperationType op); protected: typedef std::map<ConstString, lldb::OptionValueSP> collection; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueEnumeration.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueEnumeration.h index 273e69c..4aa8823 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueEnumeration.h @@ -10,16 +10,13 @@ #ifndef liblldb_OptionValueEnumeration_h_ #define liblldb_OptionValueEnumeration_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Interpreter/OptionValue.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/lldb-private-types.h" namespace lldb_private { @@ -47,10 +44,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h index 8020aa7..b53c034 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpec.h @@ -12,7 +12,7 @@ #include "lldb/Interpreter/OptionValue.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "llvm/Support/Chrono.h" namespace lldb_private { @@ -37,10 +37,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h index 1e42362..9529fbc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h @@ -37,10 +37,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormat.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormat.h index 5351aec..ce79970 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormat.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormat.h @@ -38,10 +38,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h index 472cd9e..e5a65b7 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -34,10 +34,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueLanguage.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueLanguage.h index a388a6a..8f81c5d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueLanguage.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueLanguage.h @@ -41,10 +41,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValuePathMappings.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValuePathMappings.h index d5336aa..0e2e98d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValuePathMappings.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValuePathMappings.h @@ -35,10 +35,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueProperties.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueProperties.h index bb4202a..16d31aa 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueProperties.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueProperties.h @@ -16,11 +16,11 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Core/FormatEntity.h" #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/Interpreter/Property.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { @@ -43,7 +43,7 @@ public: lldb::OptionValueSP DeepCopy() const override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; @@ -52,9 +52,9 @@ public: ConstString GetName() const override { return m_name; } - virtual Error DumpPropertyValue(const ExecutionContext *exe_ctx, Stream &strm, - llvm::StringRef property_path, - uint32_t dump_mask); + virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx, + Stream &strm, llvm::StringRef property_path, + uint32_t dump_mask); virtual void DumpAllDescriptions(CommandInterpreter &interpreter, Stream &strm) const; @@ -110,11 +110,12 @@ public: bool value_will_be_modified) const; lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, - llvm::StringRef name, bool value_will_be_modified, - Error &error) const override; + llvm::StringRef name, + bool value_will_be_modified, + Status &error) const override; - Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, - llvm::StringRef path, llvm::StringRef value) override; + Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op, + llvm::StringRef path, llvm::StringRef value) override; virtual bool PredicateMatches(const ExecutionContext *exe_ctx, llvm::StringRef predicate) const { diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueRegex.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueRegex.h index 7125daf..afe9318 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueRegex.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueRegex.h @@ -14,8 +14,8 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/RegularExpression.h" #include "lldb/Interpreter/OptionValue.h" +#include "lldb/Utility/RegularExpression.h" namespace lldb_private { @@ -35,10 +35,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueSInt64.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueSInt64.h index 1e16478..a6893d2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueSInt64.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueSInt64.h @@ -50,10 +50,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueString.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueString.h index 5b42003..4a9f222 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueString.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueString.h @@ -16,14 +16,15 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Interpreter/OptionValue.h" namespace lldb_private { class OptionValueString : public OptionValue { public: - typedef Error (*ValidatorCallback)(const char *string, void *baton); + typedef Status (*ValidatorCallback)(const char *string, void *baton); enum Options { eOptionEncodeCharacterEscapeSequences = (1u << 0) }; @@ -84,10 +85,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; @@ -118,10 +119,10 @@ public: const char *GetDefaultValue() const { return m_default_value.c_str(); } llvm::StringRef GetDefaultValueAsRef() const { return m_default_value; } - Error SetCurrentValue(const char *) = delete; - Error SetCurrentValue(llvm::StringRef value); + Status SetCurrentValue(const char *) = delete; + Status SetCurrentValue(llvm::StringRef value); - Error AppendToCurrentValue(const char *value); + Status AppendToCurrentValue(const char *value); void SetDefaultValue(const char *value) { if (value && value[0]) diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUInt64.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUInt64.h index cbf932b..be13ff0 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUInt64.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUInt64.h @@ -38,8 +38,8 @@ public: // string isn't a uint64_t value or any other error occurs, return an // empty lldb::OptionValueSP and fill error in with the correct stuff. //--------------------------------------------------------------------- - static lldb::OptionValueSP Create(const char *, Error &) = delete; - static lldb::OptionValueSP Create(llvm::StringRef value_str, Error &error); + static lldb::OptionValueSP Create(const char *, Status &) = delete; + static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error); //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- @@ -49,10 +49,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUUID.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUUID.h index 841de88..6e0aeeb 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUUID.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/OptionValueUUID.h @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/UUID.h" +#include "lldb/Utility/UUID.h" #include "lldb/Interpreter/OptionValue.h" namespace lldb_private { @@ -36,10 +36,10 @@ public: void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; - Error + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - Error + Status SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/Options.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/Options.h index fc5ff97..8712100 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/Options.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/Options.h @@ -38,7 +38,7 @@ static inline bool isprint8(int ch) { /// Options is designed to be subclassed to contain all needed /// options for a given command. The options can be parsed by calling: /// \code -/// Error Args::ParseOptions (Options &); +/// Status Args::ParseOptions (Options &); /// \endcode /// /// The options are specified using the format defined for the libc @@ -62,11 +62,11 @@ static inline bool isprint8(int ch) { /// return g_options; /// } /// -/// virtual Error +/// virtual Status /// SetOptionValue (uint32_t option_idx, int option_val, const char /// *option_arg) /// { -/// Error error; +/// Status error; /// switch (option_val) /// { /// case 'g': debug = true; break; @@ -171,7 +171,7 @@ public: // prone and subclasses shouldn't have to do it. void NotifyOptionParsingStarting(ExecutionContext *execution_context); - Error NotifyOptionParsingFinished(ExecutionContext *execution_context); + Status NotifyOptionParsingFinished(ExecutionContext *execution_context); //------------------------------------------------------------------ /// Set the value of an option. @@ -192,8 +192,8 @@ public: /// @see Args::ParseOptions (Options&) /// @see man getopt_long_only //------------------------------------------------------------------ - virtual Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) = 0; + virtual Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) = 0; //------------------------------------------------------------------ /// Handles the generic bits of figuring out whether we are in an @@ -324,10 +324,10 @@ protected: // all option settings to default values. virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0; - virtual Error OptionParsingFinished(ExecutionContext *execution_context) { + virtual Status OptionParsingFinished(ExecutionContext *execution_context) { // If subclasses need to know when the options are done being parsed // they can implement this function to do extra checking - Error error; + Status error; return error; } }; @@ -340,16 +340,16 @@ public: virtual llvm::ArrayRef<OptionDefinition> GetDefinitions() = 0; - virtual Error SetOptionValue(uint32_t option_idx, - llvm::StringRef option_value, - ExecutionContext *execution_context) = 0; + virtual Status SetOptionValue(uint32_t option_idx, + llvm::StringRef option_value, + ExecutionContext *execution_context) = 0; virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0; - virtual Error OptionParsingFinished(ExecutionContext *execution_context) { + virtual Status OptionParsingFinished(ExecutionContext *execution_context) { // If subclasses need to know when the options are done being parsed // they can implement this function to do extra checking - Error error; + Status error; return error; } }; @@ -401,12 +401,12 @@ public: bool DidFinalize() { return m_did_finalize; } - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; - Error OptionParsingFinished(ExecutionContext *execution_context) override; + Status OptionParsingFinished(ExecutionContext *execution_context) override; llvm::ArrayRef<OptionDefinition> GetDefinitions() override { assert(m_did_finalize); diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/Property.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/Property.h index e09df5c..9d0dc5f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/Property.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/Property.h @@ -10,16 +10,13 @@ #ifndef liblldb_Property_h_ #define liblldb_Property_h_ -// C Includes -// C++ Includes -#include <string> - -// Other libraries and framework includes -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Flags.h" #include "lldb/Interpreter/OptionValue.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Flags.h" #include "lldb/lldb-defines.h" +#include "lldb/lldb-private-types.h" + +#include <string> namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/contrib/llvm/tools/lldb/include/lldb/Interpreter/ScriptInterpreter.h index 3fdba08..335231c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/contrib/llvm/tools/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -18,11 +18,11 @@ #include "lldb/Breakpoint/BreakpointOptions.h" #include "lldb/Core/Broadcaster.h" -#include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StructuredData.h" -#include "lldb/Utility/PseudoTerminal.h" +#include "lldb/Host/PseudoTerminal.h" namespace lldb_private { @@ -107,24 +107,24 @@ public: return true; } - virtual Error ExecuteMultipleLines( + virtual Status ExecuteMultipleLines( const char *in_string, const ExecuteScriptOptions &options = ExecuteScriptOptions()) { - Error error; + Status error; error.SetErrorString("not implemented"); return error; } - virtual Error + virtual Status ExportFunctionDefinitionToInterpreter(StringList &function_def) { - Error error; + Status error; error.SetErrorString("not implemented"); return error; } - virtual Error GenerateBreakpointCommandCallbackData(StringList &input, - std::string &output) { - Error error; + virtual Status GenerateBreakpointCommandCallbackData(StringList &input, + std::string &output) { + Status error; error.SetErrorString("not implemented"); return error; } @@ -235,19 +235,19 @@ public: } virtual StructuredData::ObjectSP - LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error) { + LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error) { return StructuredData::ObjectSP(); } virtual StructuredData::DictionarySP GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, - const char *setting_name, lldb_private::Error &error) { + const char *setting_name, lldb_private::Status &error) { return StructuredData::DictionarySP(); } - virtual Error GenerateFunction(const char *signature, - const StringList &input) { - Error error; + virtual Status GenerateFunction(const char *signature, + const StringList &input) { + Status error; error.SetErrorString("unimplemented"); return error; } @@ -260,22 +260,22 @@ public: CommandReturnObject &result); /// Set the specified text as the callback for the breakpoint. - Error + Status SetBreakpointCommandCallback(std::vector<BreakpointOptions *> &bp_options_vec, const char *callback_text); - virtual Error SetBreakpointCommandCallback(BreakpointOptions *bp_options, - const char *callback_text) { - Error error; + virtual Status SetBreakpointCommandCallback(BreakpointOptions *bp_options, + const char *callback_text) { + Status error; error.SetErrorString("unimplemented"); return error; } /// This one is for deserialization: - virtual Error SetBreakpointCommandCallback( + virtual Status SetBreakpointCommandCallback( BreakpointOptions *bp_options, std::unique_ptr<BreakpointOptions::CommandData> &data_up) { - Error error; + Status error; error.SetErrorString("unimplemented"); return error; } @@ -346,7 +346,7 @@ public: RunScriptBasedCommand(const char *impl_function, const char *args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, - Error &error, + Status &error, const lldb_private::ExecutionContext &exe_ctx) { return false; } @@ -355,40 +355,40 @@ public: RunScriptBasedCommand(StructuredData::GenericSP impl_obj_sp, const char *args, ScriptedCommandSynchronicity synchronicity, lldb_private::CommandReturnObject &cmd_retobj, - Error &error, + Status &error, const lldb_private::ExecutionContext &exe_ctx) { return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, Process *process, std::string &output, - Error &error) { + Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, Thread *thread, - std::string &output, Error &error) { + std::string &output, Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, Target *target, - std::string &output, Error &error) { + std::string &output, Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, StackFrame *frame, std::string &output, - Error &error) { + Status &error) { error.SetErrorString("unimplemented"); return false; } virtual bool RunScriptFormatKeyword(const char *impl_function, ValueObject *value, std::string &output, - Error &error) { + Status &error) { error.SetErrorString("unimplemented"); return false; } @@ -420,7 +420,7 @@ public: virtual bool LoadScriptingModule(const char *filename, bool can_reload, bool init_session, - lldb_private::Error &error, + lldb_private::Status &error, StructuredData::ObjectSP *module_sp = nullptr) { error.SetErrorString("loading unimplemented"); return false; diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/ArmUnwindInfo.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/ArmUnwindInfo.h index cc80c0f..ef67a31 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/ArmUnwindInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/ArmUnwindInfo.h @@ -12,9 +12,9 @@ #include <vector> -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/RangeMap.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Utility/DataExtractor.h" #include "lldb/lldb-private.h" /* diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/Block.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/Block.h index eb96318..a5387cc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/Block.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/Block.h @@ -18,11 +18,12 @@ // Project includes #include "lldb/Core/AddressRange.h" #include "lldb/Core/RangeMap.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/SymbolContextScope.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/ClangASTContext.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/ClangASTContext.h index 1d7d291..08f5175 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/ClangASTContext.h @@ -31,9 +31,9 @@ // Project includes #include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" #include "lldb/Core/ClangForward.h" -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-enumerations.h" class DWARFASTParserClang; @@ -275,17 +275,16 @@ public: bool IsValid() const { if (args.empty()) return false; - return args.size() == names.size(); - } - - size_t GetSize() const { - if (IsValid()) - return args.size(); - return 0; + return args.size() == names.size() && + ((bool)pack_name == (bool)packed_args) && + (!packed_args || !packed_args->packed_args); } llvm::SmallVector<const char *, 2> names; llvm::SmallVector<clang::TemplateArgument, 2> args; + + const char * pack_name = nullptr; + std::unique_ptr<TemplateParameterInfos> packed_args; }; clang::FunctionTemplateDecl * diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompactUnwindInfo.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompactUnwindInfo.h index 133a886..6300672 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompactUnwindInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompactUnwindInfo.h @@ -13,10 +13,10 @@ #include <mutex> #include <vector> -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/RangeMap.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Utility/DataExtractor.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompileUnit.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompileUnit.h index 8465f3b..e7a1ebc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompileUnit.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompileUnit.h @@ -12,10 +12,10 @@ #include "lldb/Core/FileSpecList.h" #include "lldb/Core/ModuleChild.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/DebugMacros.h" #include "lldb/Symbol/Function.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-enumerations.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDecl.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDecl.h index a612fb6..5d744d9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDecl.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDecl.h @@ -10,8 +10,8 @@ #ifndef liblldb_CompilerDecl_h_ #define liblldb_CompilerDecl_h_ -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDeclContext.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDeclContext.h index e4f3e74..179a1be 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDeclContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerDeclContext.h @@ -12,7 +12,7 @@ #include <vector> -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerType.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerType.h index 6822160..c5bca54 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerType.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/CompilerType.h @@ -23,6 +23,8 @@ namespace lldb_private { +class DataExtractor; + //---------------------------------------------------------------------- // A class that can carry around a clang ASTContext and a opaque clang // QualType. A clang::QualType can be easily reconstructed from an diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h index c221a36..a1bd1bc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h @@ -14,13 +14,13 @@ #include <mutex> #include "lldb/Core/AddressRange.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Core/RangeMap.h" -#include "lldb/Core/VMRange.h" #include "lldb/Core/dwarf.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Utility/VMRange.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -34,10 +34,11 @@ namespace lldb_private { class DWARFCallFrameInfo { public: - DWARFCallFrameInfo(ObjectFile &objfile, lldb::SectionSP §ion, - lldb::RegisterKind reg_kind, bool is_eh_frame); + enum Type { EH, DWARF }; + + DWARFCallFrameInfo(ObjectFile &objfile, lldb::SectionSP §ion, Type type); - ~DWARFCallFrameInfo(); + ~DWARFCallFrameInfo() = default; // Locate an AddressRange that includes the provided Address in this // object's eh_frame/debug_info @@ -74,12 +75,20 @@ public: private: enum { CFI_AUG_MAX_SIZE = 8, CFI_HEADER_SIZE = 8 }; + enum CFIVersion { + CFI_VERSION1 = 1, // DWARF v.2 + CFI_VERSION3 = 3, // DWARF v.3 + CFI_VERSION4 = 4 // DWARF v.4, v.5 + }; struct CIE { dw_offset_t cie_offset; uint8_t version; char augmentation[CFI_AUG_MAX_SIZE]; // This is typically empty or very // short. + uint8_t address_size = sizeof(uint32_t); // The size of a target address. + uint8_t segment_size = 0; // The size of a segment selector. + uint32_t code_align; int32_t data_align; uint32_t return_addr_reg_num; @@ -134,21 +143,24 @@ private: ObjectFile &m_objfile; lldb::SectionSP m_section_sp; - lldb::RegisterKind m_reg_kind; - Flags m_flags; + Flags m_flags = 0; cie_map_t m_cie_map; DataExtractor m_cfi_data; - bool m_cfi_data_initialized; // only copy the section into the DE once + bool m_cfi_data_initialized = false; // only copy the section into the DE once FDEEntryMap m_fde_index; - bool m_fde_index_initialized; // only scan the section for FDEs once + bool m_fde_index_initialized = false; // only scan the section for FDEs once std::mutex m_fde_index_mutex; // and isolate the thread that does it - bool m_is_eh_frame; + Type m_type; CIESP ParseCIE(const uint32_t cie_offset); + + lldb::RegisterKind GetRegisterKind() const { + return m_type == EH ? lldb::eRegisterKindEHFrame : lldb::eRegisterKindDWARF; + } }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/DebugMacros.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/DebugMacros.h index 4d4a327..640da02 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/DebugMacros.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/DebugMacros.h @@ -17,7 +17,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/DeclVendor.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/DeclVendor.h index 5ee8b19..16d514f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/DeclVendor.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/DeclVendor.h @@ -11,6 +11,7 @@ #define liblldb_DeclVendor_h_ #include "lldb/Core/ClangForward.h" +#include "lldb/lldb-defines.h" #include <vector> diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/Declaration.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/Declaration.h index 1846e2f..581176e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/Declaration.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/Declaration.h @@ -10,7 +10,7 @@ #ifndef liblldb_Declaration_h_ #define liblldb_Declaration_h_ -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/FuncUnwinders.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/FuncUnwinders.h index a5b9b80..64c222c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/FuncUnwinders.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/FuncUnwinders.h @@ -99,6 +99,13 @@ public: Thread &thread, int current_offset); + lldb::UnwindPlanSP GetDebugFrameUnwindPlan(Target &target, + int current_offset); + + lldb::UnwindPlanSP GetDebugFrameAugmentedUnwindPlan(Target &target, + Thread &thread, + int current_offset); + lldb::UnwindPlanSP GetCompactUnwindUnwindPlan(Target &target, int current_offset); @@ -126,10 +133,12 @@ private: lldb::UnwindPlanSP m_unwind_plan_assembly_sp; lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp; - lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp; // augmented by - // assembly inspection - // so it's valid - // everywhere + lldb::UnwindPlanSP m_unwind_plan_debug_frame_sp; + + // augmented by assembly inspection so it's valid everywhere + lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp; + lldb::UnwindPlanSP m_unwind_plan_debug_frame_augmented_sp; + std::vector<lldb::UnwindPlanSP> m_unwind_plan_compact_unwind; lldb::UnwindPlanSP m_unwind_plan_arm_unwind_sp; lldb::UnwindPlanSP m_unwind_plan_fast_sp; @@ -139,7 +148,9 @@ private: // Fetching the UnwindPlans can be expensive - if we've already attempted // to get one & failed, don't try again. bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1, + m_tried_unwind_plan_debug_frame : 1, m_tried_unwind_plan_eh_frame_augmented : 1, + m_tried_unwind_plan_debug_frame_augmented : 1, m_tried_unwind_plan_compact_unwind : 1, m_tried_unwind_plan_arm_unwind : 1, m_tried_unwind_fast : 1, m_tried_unwind_arch_default : 1, diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/Function.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/Function.h index 232d079..9d37600 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/Function.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/Function.h @@ -12,10 +12,10 @@ #include "lldb/Core/AddressRange.h" #include "lldb/Core/Mangled.h" -#include "lldb/Core/UserID.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Block.h" #include "lldb/Symbol/Declaration.h" +#include "lldb/Utility/UserID.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/GoASTContext.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/GoASTContext.h index 5530a35..6feac7a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/GoASTContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/GoASTContext.h @@ -20,9 +20,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/JavaASTContext.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/JavaASTContext.h index 6e97674..4fdd237 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/JavaASTContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/JavaASTContext.h @@ -18,8 +18,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/LineEntry.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/LineEntry.h index 3076ec4..b9a1a14 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/LineEntry.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/LineEntry.h @@ -11,7 +11,7 @@ #define liblldb_LineEntry_h_ #include "lldb/Core/AddressRange.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/OCamlASTContext.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/OCamlASTContext.h index 9560866..a261d43 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/OCamlASTContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/OCamlASTContext.h @@ -21,9 +21,9 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectContainer.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectContainer.h index 6f38b50..1103792 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectContainer.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectContainer.h @@ -14,11 +14,11 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/ModuleChild.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Host/Endian.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h index e2e4500..a4c7b01 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/ObjectFile.h @@ -10,14 +10,15 @@ #ifndef liblldb_ObjectFile_h_ #define liblldb_ObjectFile_h_ -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/FileSpecList.h" #include "lldb/Core/ModuleChild.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Host/Endian.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Symbol/Symtab.h" #include "lldb/Symbol/UnwindTable.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Endian.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -563,6 +564,45 @@ public: virtual uint32_t GetNumThreadContexts() { return 0; } + //------------------------------------------------------------------ + /// Some object files may have an identifier string embedded in them, + /// e.g. in a Mach-O core file using the LC_IDENT load command (which + /// is obsolete, but can still be found in some old files) + /// + /// @return + /// Returns the identifier string if one exists, else an empty + /// string. + //------------------------------------------------------------------ + virtual std::string GetIdentifierString () { + return std::string(); + } + + //------------------------------------------------------------------ + /// When the ObjectFile is a core file, lldb needs to locate the + /// "binary" in the core file. lldb can iterate over the pages looking + /// for a valid binary, but some core files may have metadata + /// describing where the main binary is exactly which removes ambiguity + /// when there are multiple binaries present in the captured memory pages. + /// + /// @param[out] address + /// If the address of the binary is specified, this will be set. + /// This is an address is the virtual address space of the core file + /// memory segments; it is not an offset into the object file. + /// If no address is available, will be set to LLDB_INVALID_ADDRESS. + /// + /// @param[out] uuid + /// If the uuid of the binary is specified, this will be set. + /// If no UUID is available, will be cleared. + /// + /// @return + /// Returns true if either address or uuid has been set. + //------------------------------------------------------------------ + virtual bool GetCorefileMainBinaryInfo (lldb::addr_t &address, UUID &uuid) { + address = LLDB_INVALID_ADDRESS; + uuid.Clear(); + return false; + } + virtual lldb::RegisterContextSP GetThreadContextAtIndex(uint32_t idx, lldb_private::Thread &thread) { return lldb::RegisterContextSP(); @@ -765,15 +805,29 @@ public: bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; } // Strip linker annotations (such as @@VERSION) from symbol names. - virtual std::string + virtual llvm::StringRef StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const { - return symbol_name.str(); + return symbol_name; } static lldb::SymbolType GetSymbolTypeFromName( llvm::StringRef name, lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined); + //------------------------------------------------------------------ + /// Loads this objfile to memory. + /// + /// Loads the bits needed to create an executable image to the memory. + /// It is useful with bare-metal targets where target does not have the + /// ability to start a process itself. + /// + /// @param[in] target + /// Target where to load. + /// + /// @return + //------------------------------------------------------------------ + virtual Status LoadInMemory(Target &target, bool set_pc); + protected: //------------------------------------------------------------------ // Member variables. diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/Symbol.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/Symbol.h index 3f12b9a..44c67f6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/Symbol.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/Symbol.h @@ -12,8 +12,8 @@ #include "lldb/Core/AddressRange.h" #include "lldb/Core/Mangled.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/SymbolContextScope.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolContext.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolContext.h index 2ca3fdb..f84b7cf 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolContext.h @@ -234,7 +234,30 @@ public: bool use_inline_block_range, AddressRange &range) const; bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, - Error &error); + Status &error); + + //------------------------------------------------------------------ + /// Find the best global data symbol visible from this context. + /// + /// Symbol priority is: + /// - extern symbol in the current module if there is one + /// - non-extern symbol in the current module if there is one + /// - extern symbol in the target + /// - non-extern symbol in the target + /// It is an error if the highest-priority result is ambiguous. + /// + /// @param[in] name + /// The name of the symbol to search for. + /// + /// @param[out] error + /// An error that will be populated with a message if there was an + /// ambiguous result. The error will not be populated if no result + /// was found. + /// + /// @return + /// The symbol that was found, or \b nullptr if none was found. + //------------------------------------------------------------------ + const Symbol *FindBestGlobalDataSymbol(const ConstString &name, Status &error); void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target) const; diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolFile.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolFile.h index 34ae8d7..69110dc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolFile.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/SymbolFile.h @@ -180,6 +180,8 @@ public: uint32_t type_mask, lldb_private::TypeList &type_list) = 0; + virtual void PreloadSymbols(); + virtual lldb_private::TypeSystem * GetTypeSystemForLanguage(lldb::LanguageType language); diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/Symtab.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/Symtab.h index 6a8d62c..3d24862 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/Symtab.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/Symtab.h @@ -40,6 +40,7 @@ public: Symtab(ObjectFile *objfile); ~Symtab(); + void PreloadSymbols(); void Reserve(size_t count); Symbol *Resize(size_t count); uint32_t AddSymbol(const Symbol &symbol); diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/Type.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/Type.h index b2a65fa..9740dc2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/Type.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/Type.h @@ -11,11 +11,11 @@ #define liblldb_Type_h_ #include "lldb/Core/ClangForward.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/UserID.h" #include "lldb/Symbol/CompilerDecl.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Declaration.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" #include "llvm/ADT/APSInt.h" @@ -23,7 +23,6 @@ #include <set> namespace lldb_private { - //---------------------------------------------------------------------- // CompilerContext allows an array of these items to be passed to // perform detailed lookups in SymbolVendor and SymbolFile functions. diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindPlan.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindPlan.h index dfcf55b..abb57a2 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindPlan.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindPlan.h @@ -19,8 +19,8 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/AddressRange.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Stream.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindTable.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindTable.h index e730454..851d24b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindTable.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/UnwindTable.h @@ -27,6 +27,7 @@ public: ~UnwindTable(); lldb_private::DWARFCallFrameInfo *GetEHFrameInfo(); + lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo(); lldb_private::CompactUnwindInfo *GetCompactUnwindInfo(); @@ -58,6 +59,8 @@ private: void Dump(Stream &s); void Initialize(); + llvm::Optional<AddressRange> GetAddressRange(const Address &addr, + SymbolContext &sc); typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection; typedef collection::iterator iterator; @@ -70,6 +73,7 @@ private: std::mutex m_mutex; std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up; + std::unique_ptr<DWARFCallFrameInfo> m_debug_frame_up; std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up; std::unique_ptr<ArmUnwindInfo> m_arm_unwind_up; diff --git a/contrib/llvm/tools/lldb/include/lldb/Symbol/Variable.h b/contrib/llvm/tools/lldb/include/lldb/Symbol/Variable.h index 3324989..507b413 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Symbol/Variable.h +++ b/contrib/llvm/tools/lldb/include/lldb/Symbol/Variable.h @@ -15,9 +15,9 @@ #include "lldb/Core/Mangled.h" #include "lldb/Core/RangeMap.h" -#include "lldb/Core/UserID.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Declaration.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-private.h" @@ -97,7 +97,7 @@ public: typedef size_t (*GetVariableCallback)(void *baton, const char *name, VariableList &var_list); - static Error GetValuesForVariableExpressionPath( + static Status GetValuesForVariableExpressionPath( llvm::StringRef variable_expr_path, ExecutionContextScope *scope, GetVariableCallback callback, void *baton, VariableList &variable_list, ValueObjectList &valobj_list); diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ABI.h b/contrib/llvm/tools/lldb/include/lldb/Target/ABI.h index 8a12436..0418d68 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ABI.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ABI.h @@ -14,9 +14,9 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" @@ -77,8 +77,8 @@ public: bool persistent = true) const; // Set the Return value object in the current frame as though a function with - virtual Error SetReturnValueObject(lldb::StackFrameSP &frame_sp, - lldb::ValueObjectSP &new_value) = 0; + virtual Status SetReturnValueObject(lldb::StackFrameSP &frame_sp, + lldb::ValueObjectSP &new_value) = 0; protected: // This is the method the ABI will call to actually calculate the return @@ -92,6 +92,16 @@ protected: virtual lldb::ValueObjectSP GetReturnValueObjectImpl(Thread &thread, llvm::Type &ir_type) const; + //------------------------------------------------------------------ + /// Request to get a Process shared pointer. + /// + /// This ABI object may not have been created with a Process object, + /// or the Process object may no longer be alive. Be sure to handle + /// the case where the shared pointer returned does not have an + /// object inside it. + //------------------------------------------------------------------ + lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); } + public: virtual bool CreateFunctionEntryUnwindPlan(UnwindPlan &unwind_plan) = 0; @@ -131,13 +141,18 @@ public: virtual bool GetPointerReturnRegister(const char *&name) { return false; } - static lldb::ABISP FindPlugin(const ArchSpec &arch); + static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch); protected: //------------------------------------------------------------------ // Classes that inherit from ABI can see and modify these //------------------------------------------------------------------ - ABI(); + ABI(lldb::ProcessSP process_sp) { + if (process_sp.get()) + m_process_wp = process_sp; + } + + lldb::ProcessWP m_process_wp; private: DISALLOW_COPY_AND_ASSIGN(ABI); diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/DynamicLoader.h b/contrib/llvm/tools/lldb/include/lldb/Target/DynamicLoader.h index 071cbe6..b589066 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/DynamicLoader.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/DynamicLoader.h @@ -11,10 +11,38 @@ #define liblldb_DynamicLoader_h_ // Project includes -#include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/UUID.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/Utility/Status.h" +#include "lldb/Utility/UUID.h" +#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS +#include "lldb/lldb-forward.h" // for ModuleSP, ThreadPlanSP +#include "lldb/lldb-private-enumerations.h" // for LazyBool, LazyBool::eLaz... +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for int64_t +namespace lldb_private { +class ModuleList; +} +namespace lldb_private { +class Process; +} +namespace lldb_private { +class SectionList; +} +namespace lldb_private { +class Symbol; +} +namespace lldb_private { +class SymbolContext; +} +namespace lldb_private { +class SymbolContextList; +} +namespace lldb_private { +class Thread; +} namespace lldb_private { @@ -185,7 +213,7 @@ public: /// \b true if it is currently ok to try and load a shared /// library into the process, \b false otherwise. //------------------------------------------------------------------ - virtual Error CanLoadImage() = 0; + virtual Status CanLoadImage() = 0; //------------------------------------------------------------------ /// Ask if the eh_frame information for the given SymbolContext should @@ -331,6 +359,10 @@ protected: // Read a pointer from memory at the given addr. // Return LLDB_INVALID_ADDRESS if the read fails. lldb::addr_t ReadPointer(lldb::addr_t addr); + + // Calls into the Process protected method LoadOperatingSystemPlugin: + void LoadOperatingSystemPlugin(bool flush); + //------------------------------------------------------------------ // Member variables. diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/FileAction.h b/contrib/llvm/tools/lldb/include/lldb/Target/FileAction.h index 81122ec..f80f57a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/FileAction.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/FileAction.h @@ -10,7 +10,7 @@ #ifndef liblldb_Target_FileAction_h #define liblldb_Target_FileAction_h -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/FileSpec.h" #include <string> namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntime.h b/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntime.h index a40914d..21d66d5 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntime.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntime.h @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" #include "lldb/lldb-types.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h b/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h index 0a4a170..b112319 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h @@ -16,8 +16,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" #include "lldb/Target/StopInfo.h" +#include "lldb/Utility/StructuredData.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/Language.h b/contrib/llvm/tools/lldb/include/lldb/Target/Language.h index bcf840f..f81679f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/Language.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/Language.h @@ -199,7 +199,7 @@ public: // it should return an appropriate closure here virtual DumpValueObjectOptions::DeclPrintingHelper GetDeclPrintingHelper(); - virtual LazyBool IsLogicalTrue(ValueObject &valobj, Error &error); + virtual LazyBool IsLogicalTrue(ValueObject &valobj, Status &error); // for a ValueObject of some "reference type", if the value points to the // nil/null object, this method returns true diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/LanguageRuntime.h b/contrib/llvm/tools/lldb/include/lldb/Target/LanguageRuntime.h index a57216e..98db941 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/LanguageRuntime.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/LanguageRuntime.h @@ -48,7 +48,7 @@ public: static SearchFilter * CreateFromStructuredData(Target &target, const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData() override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/Memory.h b/contrib/llvm/tools/lldb/include/lldb/Target/Memory.h index 57275bb..af6be15 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/Memory.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/Memory.h @@ -40,7 +40,7 @@ public: void Flush(lldb::addr_t addr, size_t size); - size_t Read(lldb::addr_t addr, void *dst, size_t dst_len, Error &error); + size_t Read(lldb::addr_t addr, void *dst, size_t dst_len, Status &error); uint32_t GetMemoryCacheLineSize() const { return m_L2_cache_line_byte_size; } @@ -75,6 +75,8 @@ private: DISALLOW_COPY_AND_ASSIGN(MemoryCache); }; + + class AllocatedBlock { public: AllocatedBlock(lldb::addr_t addr, uint32_t byte_size, uint32_t permissions, @@ -86,32 +88,34 @@ public: bool FreeBlock(lldb::addr_t addr); - lldb::addr_t GetBaseAddress() const { return m_addr; } + lldb::addr_t GetBaseAddress() const { return m_range.GetRangeBase(); } - uint32_t GetByteSize() const { return m_byte_size; } + uint32_t GetByteSize() const { return m_range.GetByteSize(); } uint32_t GetPermissions() const { return m_permissions; } uint32_t GetChunkSize() const { return m_chunk_size; } bool Contains(lldb::addr_t addr) const { - return ((addr >= m_addr) && addr < (m_addr + m_byte_size)); + return m_range.Contains(addr); } protected: - uint32_t TotalChunks() const { return m_byte_size / m_chunk_size; } + uint32_t TotalChunks() const { return GetByteSize() / GetChunkSize(); } uint32_t CalculateChunksNeededForSize(uint32_t size) const { return (size + m_chunk_size - 1) / m_chunk_size; } - const lldb::addr_t m_addr; // Base address of this block of memory - const uint32_t m_byte_size; // 4GB of chunk should be enough... - const uint32_t m_permissions; // Permissions for this memory (logical OR of - // lldb::Permissions bits) - const uint32_t m_chunk_size; // The size of chunks that the memory at m_addr - // is divied up into - typedef std::map<uint32_t, uint32_t> OffsetToChunkSize; - OffsetToChunkSize m_offset_to_chunk_size; + // Base address of this block of memory 4GB of chunk should be enough. + Range<lldb::addr_t, uint32_t> m_range; + // Permissions for this memory (logical OR of lldb::Permissions bits) + const uint32_t m_permissions; + // The size of chunks that the memory at m_addr is divied up into. + const uint32_t m_chunk_size; + // A sorted list of free address ranges. + RangeVector<lldb::addr_t, uint32_t> m_free_blocks; + // A sorted list of reserved address. + RangeVector<lldb::addr_t, uint32_t> m_reserved_blocks; }; //---------------------------------------------------------------------- @@ -131,7 +135,7 @@ public: void Clear(); lldb::addr_t AllocateMemory(size_t byte_size, uint32_t permissions, - Error &error); + Status &error); bool DeallocateMemory(lldb::addr_t ptr); @@ -139,7 +143,7 @@ protected: typedef std::shared_ptr<AllocatedBlock> AllocatedBlockSP; AllocatedBlockSP AllocatePage(uint32_t byte_size, uint32_t permissions, - uint32_t chunk_size, Error &error); + uint32_t chunk_size, Status &error); //------------------------------------------------------------------ // Classes that inherit from MemoryCache can see and modify these diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h b/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h index be0cfa4..0824b24 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/MemoryRegionInfo.h @@ -11,8 +11,9 @@ #ifndef lldb_MemoryRegionInfo_h #define lldb_MemoryRegionInfo_h -#include "lldb/Core/ConstString.h" #include "lldb/Core/RangeMap.h" +#include "llvm/Support/FormatProviders.h" +#include "lldb/Utility/ConstString.h" #include "lldb/Utility/Range.h" namespace lldb_private { @@ -100,4 +101,24 @@ protected: }; } +namespace llvm { +template <> +struct format_provider<lldb_private::MemoryRegionInfo::OptionalBool> { + static void format(const lldb_private::MemoryRegionInfo::OptionalBool &B, + raw_ostream &OS, StringRef Options) { + switch(B) { + case lldb_private::MemoryRegionInfo::eNo: + OS << "no"; + return; + case lldb_private::MemoryRegionInfo::eYes: + OS << "yes"; + return; + case lldb_private::MemoryRegionInfo::eDontKnow: + OS << "don't know"; + return; + } + } +}; +} + #endif // #ifndef lldb_MemoryRegionInfo_h diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ModuleCache.h b/contrib/llvm/tools/lldb/include/lldb/Target/ModuleCache.h new file mode 100644 index 0000000..4959ee8 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ModuleCache.h @@ -0,0 +1,76 @@ +//===-- ModuleCache.h -------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_TARGET_MODULECACHE_H +#define LLDB_TARGET_MODULECACHE_H + +#include "lldb/lldb-forward.h" +#include "lldb/lldb-types.h" + +#include "lldb/Host/File.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Status.h" + +#include <functional> +#include <string> +#include <unordered_map> + +namespace lldb_private { + +class Module; +class UUID; + +//---------------------------------------------------------------------- +/// @class ModuleCache ModuleCache.h "lldb/Target/ModuleCache.h" +/// @brief A module cache class. +/// +/// Caches locally modules that are downloaded from remote targets. +/// Each cached module maintains 2 views: +/// - UUID view: +/// /${CACHE_ROOT}/${PLATFORM_NAME}/.cache/${UUID}/${MODULE_FILENAME} +/// - Sysroot view: +/// /${CACHE_ROOT}/${PLATFORM_NAME}/${HOSTNAME}/${MODULE_FULL_FILEPATH} +/// +/// UUID views stores a real module file, whereas Sysroot view holds a symbolic +/// link to UUID-view file. +/// +/// Example: +/// UUID view : +/// /tmp/lldb/remote-linux/.cache/30C94DC6-6A1F-E951-80C3-D68D2B89E576-D5AE213C/libc.so.6 +/// Sysroot view: /tmp/lldb/remote-linux/ubuntu/lib/x86_64-linux-gnu/libc.so.6 +//---------------------------------------------------------------------- + +class ModuleCache { +public: + using ModuleDownloader = + std::function<Status(const ModuleSpec &, const FileSpec &)>; + using SymfileDownloader = + std::function<Status(const lldb::ModuleSP &, const FileSpec &)>; + + Status GetAndPut(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, + const ModuleDownloader &module_downloader, + const SymfileDownloader &symfile_downloader, + lldb::ModuleSP &cached_module_sp, bool *did_create_ptr); + +private: + Status Put(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, const FileSpec &tmp_file, + const FileSpec &target_file); + + Status Get(const FileSpec &root_dir_spec, const char *hostname, + const ModuleSpec &module_spec, lldb::ModuleSP &cached_module_sp, + bool *did_create_ptr); + + std::unordered_map<std::string, lldb::ModuleWP> m_loaded_modules; +}; + +} // namespace lldb_private + +#endif // utility_ModuleCache_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ObjCLanguageRuntime.h b/contrib/llvm/tools/lldb/include/lldb/Target/ObjCLanguageRuntime.h index 0a9ffa9..97a2a73 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ObjCLanguageRuntime.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ObjCLanguageRuntime.h @@ -168,7 +168,7 @@ public: bool EvaluatePrecondition(StoppointCallbackContext &context) override; void GetDescription(Stream &stream, lldb::DescriptionLevel level) override; - Error ConfigurePrecondition(Args &args) override; + Status ConfigurePrecondition(Args &args) override; protected: void AddClassName(const char *class_name); diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/PathMappingList.h b/contrib/llvm/tools/lldb/include/lldb/Target/PathMappingList.h index 4e5a569..b1b551f 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/PathMappingList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/PathMappingList.h @@ -15,8 +15,8 @@ #include <map> #include <vector> // Other libraries and framework includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Error.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Status.h" // Project includes namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h b/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h index 9707093..f28a564 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/Platform.h @@ -22,11 +22,11 @@ // Other libraries and framework includes // Project includes #include "lldb/Core/ArchSpec.h" -#include "lldb/Core/ConstString.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/UserSettingsController.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/FileSpec.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-public.h" @@ -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" @@ -111,10 +112,10 @@ public: // Find an existing platform plug-in by name static lldb::PlatformSP Find(const ConstString &name); - static lldb::PlatformSP Create(const ConstString &name, Error &error); + static lldb::PlatformSP Create(const ConstString &name, Status &error); static lldb::PlatformSP Create(const ArchSpec &arch, - ArchSpec *platform_arch_ptr, Error &error); + ArchSpec *platform_arch_ptr, Status &error); static uint32_t GetNumConnectedRemotePlatforms(); @@ -156,9 +157,9 @@ public: /// Returns \b true if this Platform plug-in was able to find /// a suitable executable, \b false otherwise. //------------------------------------------------------------------ - virtual Error ResolveExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr); + virtual Status ResolveExecutable(const ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr); //------------------------------------------------------------------ /// Find a symbol file given a symbol file module specification. @@ -207,8 +208,8 @@ public: /// @return /// Returns an error that describes success or failure. //------------------------------------------------------------------ - virtual Error ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, - FileSpec &sym_file); + virtual Status ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, + FileSpec &sym_file); //------------------------------------------------------------------ /// Resolves the FileSpec to a (possibly) remote path. Remote @@ -316,8 +317,8 @@ public: /// @return /// An error object. //------------------------------------------------------------------ - virtual Error GetFileWithUUID(const FileSpec &platform_file, - const UUID *uuid_ptr, FileSpec &local_file); + virtual Status GetFileWithUUID(const FileSpec &platform_file, + const UUID *uuid_ptr, FileSpec &local_file); //---------------------------------------------------------------------- // Locate the scripting resource given a module specification. @@ -329,18 +330,18 @@ public: LocateExecutableScriptingResources(Target *target, Module &module, Stream *feedback_stream); - virtual Error GetSharedModule(const ModuleSpec &module_spec, Process *process, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - lldb::ModuleSP *old_module_sp_ptr, - bool *did_create_ptr); + virtual Status GetSharedModule(const ModuleSpec &module_spec, + Process *process, lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + lldb::ModuleSP *old_module_sp_ptr, + bool *did_create_ptr); virtual bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec); - virtual Error ConnectRemote(Args &args); + virtual Status ConnectRemote(Args &args); - virtual Error DisconnectRemote(); + virtual Status DisconnectRemote(); //------------------------------------------------------------------ /// Get the platform's supported architectures in the order in which @@ -367,7 +368,7 @@ public: /// Launch a new process on a platform, not necessarily for /// debugging, it could be just for running the process. //------------------------------------------------------------------ - virtual Error LaunchProcess(ProcessLaunchInfo &launch_info); + virtual Status LaunchProcess(ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ /// Perform expansion of the command-line for this launch info @@ -376,12 +377,12 @@ public: // argument magic the platform defines as part of its typical // user experience //------------------------------------------------------------------ - virtual Error ShellExpandArguments(ProcessLaunchInfo &launch_info); + virtual Status ShellExpandArguments(ProcessLaunchInfo &launch_info); //------------------------------------------------------------------ /// Kill process on a platform. //------------------------------------------------------------------ - virtual Error KillProcess(const lldb::pid_t pid); + virtual Status KillProcess(const lldb::pid_t pid); //------------------------------------------------------------------ /// Lets a platform answer if it is compatible with a given @@ -411,13 +412,13 @@ public: DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be nullptr, if nullptr create a new // target, else use existing one - Error &error); + Status &error); virtual lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, lldb_private::Debugger &debugger, lldb_private::Target *target, - lldb_private::Error &error); + lldb_private::Status &error); //------------------------------------------------------------------ /// Attach to an existing process using a process ID. @@ -442,7 +443,7 @@ public: Target *target, // Can be nullptr, if nullptr // create a new target, else // use existing one - Error &error) = 0; + Status &error) = 0; //------------------------------------------------------------------ /// Attach to an existing process by process name. @@ -464,7 +465,7 @@ public: // virtual lldb::ProcessSP // Attach (const char *process_name, // bool wait_for_launch, - // Error &error) = 0; + // Status &error) = 0; //------------------------------------------------------------------ // The base class Platform will take care of the host platform. @@ -552,27 +553,27 @@ public: return false; } - virtual Error MakeDirectory(const FileSpec &file_spec, uint32_t permissions); + virtual Status MakeDirectory(const FileSpec &file_spec, uint32_t permissions); - virtual Error GetFilePermissions(const FileSpec &file_spec, - uint32_t &file_permissions); + virtual Status GetFilePermissions(const FileSpec &file_spec, + uint32_t &file_permissions); - virtual Error SetFilePermissions(const FileSpec &file_spec, - uint32_t file_permissions); + virtual Status SetFilePermissions(const FileSpec &file_spec, + uint32_t file_permissions); virtual lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, - uint32_t mode, Error &error) { + uint32_t mode, Status &error) { return UINT64_MAX; } - virtual bool CloseFile(lldb::user_id_t fd, Error &error) { return false; } + virtual bool CloseFile(lldb::user_id_t fd, Status &error) { return false; } virtual lldb::user_id_t GetFileSize(const FileSpec &file_spec) { return UINT64_MAX; } virtual uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, - uint64_t dst_len, Error &error) { + uint64_t dst_len, Status &error) { error.SetErrorStringWithFormat( "Platform::ReadFile() is not supported in the %s platform", GetName().GetCString()); @@ -580,19 +581,19 @@ public: } virtual uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, - const void *src, uint64_t src_len, Error &error) { + const void *src, uint64_t src_len, Status &error) { error.SetErrorStringWithFormat( "Platform::ReadFile() is not supported in the %s platform", GetName().GetCString()); return -1; } - virtual Error GetFile(const FileSpec &source, const FileSpec &destination); + virtual Status GetFile(const FileSpec &source, const FileSpec &destination); - virtual Error PutFile(const FileSpec &source, const FileSpec &destination, - uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX); + virtual Status PutFile(const FileSpec &source, const FileSpec &destination, + uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX); - virtual Error + virtual Status CreateSymlink(const FileSpec &src, // The name of the link is in src const FileSpec &dst); // The symlink points to dst @@ -620,16 +621,19 @@ public: /// @return /// An error object that describes anything that went wrong. //---------------------------------------------------------------------- - virtual Error Install(const FileSpec &src, const FileSpec &dst); + virtual Status Install(const FileSpec &src, const FileSpec &dst); virtual size_t GetEnvironment(StringList &environment); virtual bool GetFileExists(const lldb_private::FileSpec &file_spec); - virtual Error Unlink(const FileSpec &file_spec); + 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; } @@ -664,7 +668,7 @@ public: return nullptr; } - virtual lldb_private::Error RunShellCommand( + virtual lldb_private::Status RunShellCommand( const char *command, // Shouldn't be nullptr const FileSpec &working_dir, // Pass empty FileSpec to use the current // working directory @@ -830,14 +834,14 @@ public: uint32_t LoadImage(lldb_private::Process *process, const lldb_private::FileSpec &local_file, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error); + lldb_private::Status &error); virtual uint32_t DoLoadImage(lldb_private::Process *process, const lldb_private::FileSpec &remote_file, - lldb_private::Error &error); + lldb_private::Status &error); - virtual Error UnloadImage(lldb_private::Process *process, - uint32_t image_token); + virtual Status UnloadImage(lldb_private::Process *process, + uint32_t image_token); //------------------------------------------------------------------ /// Connect to all processes waiting for a debugger to attach @@ -856,7 +860,7 @@ public: /// The number of processes we are successfully connected to. //------------------------------------------------------------------ virtual size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger, - lldb_private::Error &error); + lldb_private::Status &error); protected: bool m_is_host; @@ -977,35 +981,35 @@ protected: m_gid_map.clear(); } - Error GetCachedExecutable(ModuleSpec &module_spec, lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - Platform &remote_platform); + Status GetCachedExecutable(ModuleSpec &module_spec, lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + Platform &remote_platform); - virtual Error DownloadModuleSlice(const FileSpec &src_file_spec, - const uint64_t src_offset, - const uint64_t src_size, - const FileSpec &dst_file_spec); + virtual Status DownloadModuleSlice(const FileSpec &src_file_spec, + const uint64_t src_offset, + const uint64_t src_size, + const FileSpec &dst_file_spec); - virtual Error DownloadSymbolFile(const lldb::ModuleSP &module_sp, - const FileSpec &dst_file_spec); + virtual Status DownloadSymbolFile(const lldb::ModuleSP &module_sp, + const FileSpec &dst_file_spec); virtual const char *GetCacheHostname(); private: - typedef std::function<Error(const ModuleSpec &)> ModuleResolver; + typedef std::function<Status(const ModuleSpec &)> ModuleResolver; - Error GetRemoteSharedModule(const ModuleSpec &module_spec, Process *process, - lldb::ModuleSP &module_sp, - const ModuleResolver &module_resolver, - bool *did_create_ptr); + Status GetRemoteSharedModule(const ModuleSpec &module_spec, Process *process, + lldb::ModuleSP &module_sp, + const ModuleResolver &module_resolver, + bool *did_create_ptr); bool GetCachedSharedModule(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, bool *did_create_ptr); - Error LoadCachedExecutable(const ModuleSpec &module_spec, - lldb::ModuleSP &module_sp, - const FileSpecList *module_search_paths_ptr, - Platform &remote_platform); + Status LoadCachedExecutable(const ModuleSpec &module_spec, + lldb::ModuleSP &module_sp, + const FileSpecList *module_search_paths_ptr, + Platform &remote_platform); FileSpec GetModuleCacheRoot(); @@ -1088,7 +1092,7 @@ public: ~OptionGroupPlatformRSync() override = default; - lldb_private::Error + lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override; @@ -1117,7 +1121,7 @@ public: ~OptionGroupPlatformSSH() override = default; - lldb_private::Error + lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override; @@ -1144,7 +1148,7 @@ public: ~OptionGroupPlatformCaching() override = default; - lldb_private::Error + lldb_private::Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override; diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/Process.h b/contrib/llvm/tools/lldb/include/lldb/Target/Process.h index 251dfe6..df09570 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/Process.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/Process.h @@ -30,12 +30,10 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Communication.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Event.h" #include "lldb/Core/Listener.h" #include "lldb/Core/LoadedModuleInfoList.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Core/ThreadSafeValue.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" @@ -48,6 +46,10 @@ #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/QueueList.h" #include "lldb/Target/ThreadList.h" +#include "lldb/Utility/NameMatches.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/Utility/TraceOptions.h" #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" @@ -280,8 +282,8 @@ public: ~ProcessLaunchCommandOptions() override = default; - Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, - ExecutionContext *execution_context) override; + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override { launch_info.Clear(); @@ -305,11 +307,11 @@ public: class ProcessInstanceInfoMatch { public: ProcessInstanceInfoMatch() - : m_match_info(), m_name_match_type(eNameMatchIgnore), + : m_match_info(), m_name_match_type(NameMatch::Ignore), m_match_all_users(false) {} ProcessInstanceInfoMatch(const char *process_name, - NameMatchType process_name_match_type) + NameMatch process_name_match_type) : m_match_info(), m_name_match_type(process_name_match_type), m_match_all_users(false) { m_match_info.GetExecutableFile().SetFile(process_name, false); @@ -323,9 +325,9 @@ public: void SetMatchAllUsers(bool b) { m_match_all_users = b; } - NameMatchType GetNameMatchType() const { return m_name_match_type; } + NameMatch GetNameMatchType() const { return m_name_match_type; } - void SetNameMatchType(NameMatchType name_match_type) { + void SetNameMatchType(NameMatch name_match_type) { m_name_match_type = name_match_type; } @@ -338,7 +340,7 @@ public: protected: ProcessInstanceInfo m_match_info; - NameMatchType m_name_match_type; + NameMatch m_name_match_type; bool m_match_all_users; }; @@ -504,6 +506,7 @@ class Process : public std::enable_shared_from_this<Process>, public PluginInterface { friend class FunctionCaller; // For WaitForStateChangeEventsPrivate friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive + friend class DynamicLoader; // For LoadOperatingSystemPlugin friend class ProcessEventData; friend class StopInfo; friend class Target; @@ -789,12 +792,12 @@ public: /// An error object. Call GetID() to get the process ID if /// the error object is success. //------------------------------------------------------------------ - virtual Error Launch(ProcessLaunchInfo &launch_info); + virtual Status Launch(ProcessLaunchInfo &launch_info); - virtual Error LoadCore(); + virtual Status LoadCore(); - virtual Error DoLoadCore() { - Error error; + virtual Status DoLoadCore() { + Status error; error.SetErrorStringWithFormat( "error: %s does not support loading core files.", GetPluginName().GetCString()); @@ -866,7 +869,7 @@ public: /// Returns \a pid if attaching was successful, or /// LLDB_INVALID_PROCESS_ID if attaching fails. //------------------------------------------------------------------ - virtual Error Attach(ProcessAttachInfo &attach_info); + virtual Status Attach(ProcessAttachInfo &attach_info); //------------------------------------------------------------------ /// Attach to a remote system via a URL @@ -882,7 +885,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error ConnectRemote(Stream *strm, llvm::StringRef remote_url); + virtual Status ConnectRemote(Stream *strm, llvm::StringRef remote_url); bool GetShouldDetach() const { return m_should_detach; } @@ -989,9 +992,9 @@ public: /// @see Thread:Step() /// @see Thread:Suspend() //------------------------------------------------------------------ - Error Resume(); + Status Resume(); - Error ResumeSynchronous(Stream *stream); + Status ResumeSynchronous(Stream *stream); //------------------------------------------------------------------ /// Halts a running process. @@ -1013,7 +1016,7 @@ public: /// halted. /// otherwise the halt has failed. //------------------------------------------------------------------ - Error Halt(bool clear_thread_plans = false, bool use_run_lock = true); + Status Halt(bool clear_thread_plans = false, bool use_run_lock = true); //------------------------------------------------------------------ /// Detaches from a running or stopped process. @@ -1027,7 +1030,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - Error Detach(bool keep_stopped); + Status Detach(bool keep_stopped); //------------------------------------------------------------------ /// Kills the process and shuts down all threads that were spawned @@ -1047,7 +1050,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - Error Destroy(bool force_kill); + Status Destroy(bool force_kill); //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. @@ -1058,7 +1061,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - Error Signal(int signal); + Status Signal(int signal); void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp); @@ -1077,7 +1080,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillAttachToProcessWithID(lldb::pid_t pid) { return Error(); } + virtual Status WillAttachToProcessWithID(lldb::pid_t pid) { return Status(); } //------------------------------------------------------------------ /// Called before attaching to a process. @@ -1088,9 +1091,9 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillAttachToProcessWithName(const char *process_name, - bool wait_for_launch) { - return Error(); + virtual Status WillAttachToProcessWithName(const char *process_name, + bool wait_for_launch) { + return Status(); } //------------------------------------------------------------------ @@ -1107,8 +1110,8 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { - Error error; + virtual Status DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { + Status error; error.SetErrorString("remote connections are not supported"); return error; } @@ -1124,14 +1127,14 @@ public: /// will return the uid to attach as. /// /// @return - /// Returns a successful Error attaching was successful, or + /// Returns a successful Status attaching was successful, or /// an appropriate (possibly platform-specific) error code if /// attaching fails. /// hanming : need flag //------------------------------------------------------------------ - virtual Error DoAttachToProcessWithID(lldb::pid_t pid, - const ProcessAttachInfo &attach_info) { - Error error; + virtual Status DoAttachToProcessWithID(lldb::pid_t pid, + const ProcessAttachInfo &attach_info) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support attaching to a process by pid", GetPluginName().GetCString()); @@ -1149,14 +1152,14 @@ public: /// will return the uid to attach as. /// /// @return - /// Returns a successful Error attaching was successful, or + /// Returns a successful Status attaching was successful, or /// an appropriate (possibly platform-specific) error code if /// attaching fails. //------------------------------------------------------------------ - virtual Error + virtual Status DoAttachToProcessWithName(const char *process_name, const ProcessAttachInfo &attach_info) { - Error error; + Status error; error.SetErrorString("attach by name is not supported"); return error; } @@ -1199,7 +1202,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillLaunch(Module *module) { return Error(); } + virtual Status WillLaunch(Module *module) { return Status(); } //------------------------------------------------------------------ /// Launch a new process. @@ -1217,11 +1220,11 @@ public: /// requested launch. /// /// @return - /// An Error instance indicating success or failure of the + /// An Status instance indicating success or failure of the /// operation. //------------------------------------------------------------------ - virtual Error DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { - Error error; + virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support launching processes", GetPluginName().GetCString()); @@ -1245,7 +1248,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillResume() { return Error(); } + virtual Status WillResume() { return Status(); } //------------------------------------------------------------------ /// Resumes all of a process's threads as configured using the @@ -1264,8 +1267,8 @@ public: /// @see Thread:Step() /// @see Thread:Suspend() //------------------------------------------------------------------ - virtual Error DoResume() { - Error error; + virtual Status DoResume() { + Status error; error.SetErrorStringWithFormat( "error: %s does not support resuming processes", GetPluginName().GetCString()); @@ -1289,7 +1292,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillHalt() { return Error(); } + virtual Status WillHalt() { return Status(); } //------------------------------------------------------------------ /// Halts a running process. @@ -1311,8 +1314,8 @@ public: /// Returns \b true if the process successfully halts, \b false /// otherwise. //------------------------------------------------------------------ - virtual Error DoHalt(bool &caused_stop) { - Error error; + virtual Status DoHalt(bool &caused_stop) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support halting processes", GetPluginName().GetCString()); @@ -1336,7 +1339,7 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error WillDetach() { return Error(); } + virtual Status WillDetach() { return Status(); } //------------------------------------------------------------------ /// Detaches from a running or stopped process. @@ -1345,8 +1348,8 @@ public: /// Returns \b true if the process successfully detaches, \b /// false otherwise. //------------------------------------------------------------------ - virtual Error DoDetach(bool keep_stopped) { - Error error; + virtual Status DoDetach(bool keep_stopped) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support detaching from processes", GetPluginName().GetCString()); @@ -1374,7 +1377,7 @@ public: /// Process::DoSignal(int), otherwise an error describing what /// prevents the signal from being sent. //------------------------------------------------------------------ - virtual Error WillSignal() { return Error(); } + virtual Status WillSignal() { return Status(); } //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. @@ -1382,17 +1385,17 @@ public: /// @return /// Returns an error object. //------------------------------------------------------------------ - virtual Error DoSignal(int signal) { - Error error; + virtual Status DoSignal(int signal) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support sending signals to processes", GetPluginName().GetCString()); return error; } - virtual Error WillDestroy() { return Error(); } + virtual Status WillDestroy() { return Status(); } - virtual Error DoDestroy() = 0; + virtual Status DoDestroy() = 0; virtual void DidDestroy() {} @@ -1703,7 +1706,7 @@ public: /// The number of bytes that were actually read into \a buf. //------------------------------------------------------------------ virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error) = 0; + Status &error) = 0; //------------------------------------------------------------------ /// Read of memory from a process. @@ -1735,7 +1738,7 @@ public: /// returned to indicate an error. //------------------------------------------------------------------ virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error); + Status &error); //------------------------------------------------------------------ /// Read a NULL terminated string from memory @@ -1767,7 +1770,7 @@ public: /// The error status or the number of bytes prior to the null terminator. //------------------------------------------------------------------ size_t ReadStringFromMemory(lldb::addr_t vm_addr, char *str, size_t max_bytes, - Error &error, size_t type_width = 1); + Status &error, size_t type_width = 1); //------------------------------------------------------------------ /// Read a NULL terminated C string from memory @@ -1779,13 +1782,13 @@ public: /// terminated (at most cstr_max_len - 1 bytes will be read). //------------------------------------------------------------------ size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, - size_t cstr_max_len, Error &error); + size_t cstr_max_len, Status &error); size_t ReadCStringFromMemory(lldb::addr_t vm_addr, std::string &out_str, - Error &error); + Status &error); size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, - Error &error); + Status &error); //------------------------------------------------------------------ /// Reads an unsigned integer of the specified byte size from @@ -1816,15 +1819,15 @@ public: //------------------------------------------------------------------ uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, - Error &error); + Status &error); int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, - int64_t fail_value, Error &error); + int64_t fail_value, Status &error); - lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Error &error); + lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error); bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, - Error &error); + Status &error); //------------------------------------------------------------------ /// Actually do the writing of memory to a process. @@ -1847,7 +1850,7 @@ public: /// The number of bytes that were actually written. //------------------------------------------------------------------ virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, - size_t size, Error &error) { + size_t size, Status &error) { error.SetErrorStringWithFormat( "error: %s does not support writing to processes", GetPluginName().GetCString()); @@ -1887,11 +1890,11 @@ public: /// The number of bytes that were actually written. //------------------------------------------------------------------ size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar, - size_t size, Error &error); + size_t size, Status &error); size_t ReadScalarIntegerFromMemory(lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, - Error &error); + Status &error); //------------------------------------------------------------------ /// Write memory to a process. @@ -1920,7 +1923,7 @@ public: //------------------------------------------------------------------ // TODO: change this to take an ArrayRef<uint8_t> size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, - Error &error); + Status &error); //------------------------------------------------------------------ /// Actually allocate memory in the process. @@ -1938,7 +1941,7 @@ public: //------------------------------------------------------------------ virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, - Error &error) { + Status &error) { error.SetErrorStringWithFormat( "error: %s does not support allocating in the debug process", GetPluginName().GetCString()); @@ -1968,7 +1971,7 @@ public: /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. //------------------------------------------------------------------ - lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Error &error); + lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error); //------------------------------------------------------------------ /// The public interface to allocating memory in the process, this also @@ -1995,7 +1998,8 @@ public: /// LLDB_INVALID_ADDRESS if the allocation failed. //------------------------------------------------------------------ - lldb::addr_t CallocateMemory(size_t size, uint32_t permissions, Error &error); + lldb::addr_t CallocateMemory(size_t size, uint32_t permissions, + Status &error); //------------------------------------------------------------------ /// Resolve dynamically loaded indirect functions. @@ -2011,7 +2015,7 @@ public: /// LLDB_INVALID_ADDRESS if the resolution failed. //------------------------------------------------------------------ virtual lldb::addr_t ResolveIndirectFunction(const Address *address, - Error &error); + Status &error); //------------------------------------------------------------------ /// Locate the memory region that contains load_addr. @@ -2039,9 +2043,9 @@ public: /// @return /// An error value. //------------------------------------------------------------------ - virtual Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) { - Error error; + virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) { + Status error; error.SetErrorString("Process::GetMemoryRegionInfo() not supported"); return error; } @@ -2056,18 +2060,18 @@ public: /// @return /// An error value. //------------------------------------------------------------------ - virtual Error + virtual Status GetMemoryRegions(std::vector<lldb::MemoryRegionInfoSP> ®ion_list); - virtual Error GetWatchpointSupportInfo(uint32_t &num) { - Error error; + virtual Status GetWatchpointSupportInfo(uint32_t &num) { + Status error; num = 0; error.SetErrorString("Process::GetWatchpointSupportInfo() not supported"); return error; } - virtual Error GetWatchpointSupportInfo(uint32_t &num, bool &after) { - Error error; + virtual Status GetWatchpointSupportInfo(uint32_t &num, bool &after) { + Status error; num = 0; after = true; error.SetErrorString("Process::GetWatchpointSupportInfo() not supported"); @@ -2162,8 +2166,8 @@ public: /// @return /// \btrue if the memory was deallocated, \bfalse otherwise. //------------------------------------------------------------------ - virtual Error DoDeallocateMemory(lldb::addr_t ptr) { - Error error; + virtual Status DoDeallocateMemory(lldb::addr_t ptr) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support deallocating in the debug process", GetPluginName().GetCString()); @@ -2183,7 +2187,7 @@ public: /// @return /// \btrue if the memory was deallocated, \bfalse otherwise. //------------------------------------------------------------------ - Error DeallocateMemory(lldb::addr_t ptr); + Status DeallocateMemory(lldb::addr_t ptr); //------------------------------------------------------------------ /// Get any available STDOUT. @@ -2215,7 +2219,7 @@ public: /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDOUT data. //------------------------------------------------------------------ - virtual size_t GetSTDOUT(char *buf, size_t buf_size, Error &error); + virtual size_t GetSTDOUT(char *buf, size_t buf_size, Status &error); //------------------------------------------------------------------ /// Get any available STDERR. @@ -2247,7 +2251,7 @@ public: /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDERR data. //------------------------------------------------------------------ - virtual size_t GetSTDERR(char *buf, size_t buf_size, Error &error); + virtual size_t GetSTDERR(char *buf, size_t buf_size, Status &error); //------------------------------------------------------------------ /// Puts data into this process's STDIN. @@ -2270,7 +2274,7 @@ public: /// less than \a buf_size, another call to this function should /// be made to write the rest of the data. //------------------------------------------------------------------ - virtual size_t PutSTDIN(const char *buf, size_t buf_size, Error &error) { + virtual size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) { error.SetErrorString("stdin unsupported"); return 0; } @@ -2290,23 +2294,23 @@ public: /// equal to \a buf_size, another call to this function should /// be made to retrieve more profile data. //------------------------------------------------------------------ - virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Error &error); + virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Status &error); //---------------------------------------------------------------------- // Process Breakpoints //---------------------------------------------------------------------- size_t GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site); - virtual Error EnableBreakpointSite(BreakpointSite *bp_site) { - Error error; + virtual Status EnableBreakpointSite(BreakpointSite *bp_site) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support enabling breakpoints", GetPluginName().GetCString()); return error; } - virtual Error DisableBreakpointSite(BreakpointSite *bp_site) { - Error error; + virtual Status DisableBreakpointSite(BreakpointSite *bp_site) { + Status error; error.SetErrorStringWithFormat( "error: %s does not support disabling breakpoints", GetPluginName().GetCString()); @@ -2317,13 +2321,13 @@ public: // don't need to implement this function unless the standard flow of // read existing opcode, write breakpoint opcode, verify breakpoint opcode // doesn't work for a specific process plug-in. - virtual Error EnableSoftwareBreakpoint(BreakpointSite *bp_site); + virtual Status EnableSoftwareBreakpoint(BreakpointSite *bp_site); // This is implemented completely using the lldb::Process API. Subclasses // don't need to implement this function unless the standard flow of // restoring original opcode in memory and verifying the restored opcode // doesn't work for a specific process plug-in. - virtual Error DisableSoftwareBreakpoint(BreakpointSite *bp_site); + virtual Status DisableSoftwareBreakpoint(BreakpointSite *bp_site); BreakpointSiteList &GetBreakpointSiteList(); @@ -2331,14 +2335,14 @@ public: void DisableAllBreakpointSites(); - Error ClearBreakpointSiteByID(lldb::user_id_t break_id); + Status ClearBreakpointSiteByID(lldb::user_id_t break_id); lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware); - Error DisableBreakpointSiteByID(lldb::user_id_t break_id); + Status DisableBreakpointSiteByID(lldb::user_id_t break_id); - Error EnableBreakpointSiteByID(lldb::user_id_t break_id); + Status EnableBreakpointSiteByID(lldb::user_id_t break_id); // BreakpointLocations use RemoveOwnerFromBreakpointSite to remove // themselves from the owner's list of this breakpoint sites. @@ -2349,9 +2353,9 @@ public: //---------------------------------------------------------------------- // Process Watchpoints (optional) //---------------------------------------------------------------------- - virtual Error EnableWatchpoint(Watchpoint *wp, bool notify = true); + virtual Status EnableWatchpoint(Watchpoint *wp, bool notify = true); - virtual Error DisableWatchpoint(Watchpoint *wp, bool notify = true); + virtual Status DisableWatchpoint(Watchpoint *wp, bool notify = true); //------------------------------------------------------------------ // Thread Queries @@ -2605,13 +2609,13 @@ public: bool RunPreResumeActions(); void ClearPreResumeActions(); - + void ClearPreResumeAction(PreResumeActionCallback callback, void *baton); ProcessRunLock &GetRunLock(); - virtual Error SendEventData(const char *data) { - Error return_error("Sending an event is not supported for this process."); + virtual Status SendEventData(const char *data) { + Status return_error("Sending an event is not supported for this process."); return return_error; } @@ -2662,9 +2666,9 @@ public: /// The load address of the file if it is loaded into the /// processes address space, LLDB_INVALID_ADDRESS otherwise. //------------------------------------------------------------------ - virtual Error GetFileLoadAddress(const FileSpec &file, bool &is_loaded, - lldb::addr_t &load_addr) { - return Error("Not supported"); + virtual Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded, + lldb::addr_t &load_addr) { + return Status("Not supported"); } size_t AddImageToken(lldb::addr_t image_ptr); @@ -2726,7 +2730,7 @@ public: /// @return /// Returns the result of attempting to configure the feature. //------------------------------------------------------------------ - virtual Error + virtual Status ConfigureStructuredData(const ConstString &type_name, const StructuredData::ObjectSP &config_sp); @@ -2764,6 +2768,74 @@ public: lldb::StructuredDataPluginSP GetStructuredDataPlugin(const ConstString &type_name) const; + //------------------------------------------------------------------ + /// Starts tracing with the configuration provided in options. To + /// enable tracing on the complete process the thread_id in the + /// options should be set to LLDB_INVALID_THREAD_ID. The API returns + /// a user_id which is needed by other API's that manipulate the + /// trace instance. + /// The handling of erroneous or unsupported configuration is left + /// to the trace technology implementations in the server, as they + /// could be returned as an error, or rounded to a valid + /// configuration to start tracing. In the later case the + /// GetTraceConfig should supply the actual used trace + /// configuration. + //------------------------------------------------------------------ + virtual lldb::user_id_t StartTrace(const TraceOptions &options, + Status &error) { + error.SetErrorString("Not implemented"); + return LLDB_INVALID_UID; + } + + //------------------------------------------------------------------ + /// Stops the tracing instance leading to deletion of the trace + /// data. The tracing instance is identified by the user_id which + /// is obtained when tracing was started from the StartTrace. + /// In case tracing of the complete process needs to be stopped + /// the thread_id should be set to LLDB_INVALID_THREAD_ID. + /// In the other case that tracing on an individual thread needs + /// to be stopped a thread_id can be supplied. + //------------------------------------------------------------------ + virtual Status StopTrace(lldb::user_id_t uid, lldb::tid_t thread_id) { + return Status("Not implemented"); + } + + //------------------------------------------------------------------ + /// Provides the trace data as raw bytes. A buffer needs to be + /// supplied to copy the trace data. The exact behavior of this API + /// may vary across trace technology, as some may support partial + /// reading of the trace data from a specified offset while some + /// may not. The thread_id should be used to select a particular + /// thread for trace extraction. + //------------------------------------------------------------------ + virtual Status GetData(lldb::user_id_t uid, lldb::tid_t thread_id, + llvm::MutableArrayRef<uint8_t> &buffer, + size_t offset = 0) { + return Status("Not implemented"); + } + + //------------------------------------------------------------------ + /// Similar API as above except for obtaining meta data + //------------------------------------------------------------------ + virtual Status GetMetaData(lldb::user_id_t uid, lldb::tid_t thread_id, + llvm::MutableArrayRef<uint8_t> &buffer, + size_t offset = 0) { + return Status("Not implemented"); + } + + //------------------------------------------------------------------ + /// API to obtain the trace configuration used by a trace instance. + /// Configurations that may be specific to some trace technology + /// should be stored in the custom parameters. The options are + /// transported to the server, which shall interpret accordingly. + /// The thread_id can be specified in the options to obtain the + /// configuration used by a specific thread. The thread_id specified + /// should also match the uid otherwise an error will be returned. + //------------------------------------------------------------------ + virtual Status GetTraceConfig(lldb::user_id_t uid, TraceOptions &options) { + return Status("Not implemented"); + } + protected: void SetState(lldb::EventSP &event_sp); @@ -2774,9 +2846,9 @@ protected: /// state of m_run_lock, but just causes the process to resume. /// /// @return - /// An Error object describing the success or failure of the resume. + /// An Status object describing the success or failure of the resume. //------------------------------------------------------------------ - Error PrivateResume(); + Status PrivateResume(); //------------------------------------------------------------------ // Called internally @@ -3103,7 +3175,7 @@ private: protected: void HandlePrivateEvent(lldb::EventSP &event_sp); - Error HaltPrivate(); + Status HaltPrivate(); lldb::StateType WaitForProcessStopPrivate(lldb::EventSP &event_sp, const Timeout<std::micro> &timeout); @@ -3120,7 +3192,7 @@ protected: const Timeout<std::micro> &timeout); size_t WriteMemoryPrivate(lldb::addr_t addr, const void *buf, size_t size, - Error &error); + Status &error); void AppendSTDOUT(const char *s, size_t len); @@ -3141,7 +3213,9 @@ protected: return static_cast<bool>(m_process_input_reader); } - Error StopForDestroyOrDetach(lldb::EventSP &exit_event_sp); + Status StopForDestroyOrDetach(lldb::EventSP &exit_event_sp); + + virtual Status UpdateAutomaticSignalFiltering(); bool StateChangedIsExternallyHijacked(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ProcessInfo.h b/contrib/llvm/tools/lldb/include/lldb/Target/ProcessInfo.h index f8d37fa..03b1524 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ProcessInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ProcessInfo.h @@ -12,8 +12,8 @@ // LLDB headers #include "lldb/Core/ArchSpec.h" -#include "lldb/Host/FileSpec.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { //---------------------------------------------------------------------- diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ProcessLaunchInfo.h b/contrib/llvm/tools/lldb/include/lldb/Target/ProcessLaunchInfo.h index 2c192c2..93a1a9e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ProcessLaunchInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ProcessLaunchInfo.h @@ -14,12 +14,13 @@ #include <string> // LLDB Headers -#include "lldb/Core/Flags.h" -#include "lldb/Host/FileSpec.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Host/Host.h" +#include "lldb/Host/PseudoTerminal.h" #include "lldb/Target/FileAction.h" #include "lldb/Target/ProcessInfo.h" -#include "lldb/Utility/PseudoTerminal.h" +#include "lldb/Utility/FileSpec.h" namespace lldb_private { @@ -93,7 +94,7 @@ public: void Clear(); - bool ConvertArgumentsForLaunchingInShell(Error &error, bool localhost, + bool ConvertArgumentsForLaunchingInShell(Status &error, bool localhost, bool will_debug, bool first_arg_is_full_shell_command, int32_t num_resumes); diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/ProcessStructReader.h b/contrib/llvm/tools/lldb/include/lldb/Target/ProcessStructReader.h index eb51263..cfc8fe1 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/ProcessStructReader.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ProcessStructReader.h @@ -1,5 +1,4 @@ -//===---------------------ProcessStructReader.h ------------------*- C++ -//-*-===// +//===---------------------ProcessStructReader.h ------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -8,17 +7,17 @@ // //===----------------------------------------------------------------------===// -#ifndef utility_ProcessStructReader_h_ -#define utility_ProcessStructReader_h_ +#ifndef LLDB_TARGET_PROCESSSTRUCTREADER_H +#define LLDB_TARGET_PROCESSSTRUCTREADER_H #include "lldb/lldb-defines.h" #include "lldb/lldb-types.h" -#include "lldb/Core/ConstString.h" -#include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Error.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Target/Process.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/Status.h" #include <initializer_list> #include <map> @@ -69,7 +68,7 @@ public: } size_t total_size = struct_type.GetByteSize(nullptr); lldb::DataBufferSP buffer_sp(new DataBufferHeap(total_size, 0)); - Error error; + Status error; process->ReadMemoryFromInferior(base_addr, buffer_sp->GetBytes(), total_size, error); if (error.Fail()) diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/QueueItem.h b/contrib/llvm/tools/lldb/include/lldb/Target/QueueItem.h index f637850..acbf94e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/QueueItem.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/QueueItem.h @@ -23,7 +23,7 @@ #include "lldb/lldb-private.h" #include "lldb/Core/Address.h" -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/QueueList.h b/contrib/llvm/tools/lldb/include/lldb/Target/QueueList.h index 038463d..91cf3eb 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/QueueList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/QueueList.h @@ -13,8 +13,8 @@ #include <mutex> #include <vector> -#include "lldb/Core/UserID.h" #include "lldb/Utility/Iterable.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/RegisterCheckpoint.h b/contrib/llvm/tools/lldb/include/lldb/Target/RegisterCheckpoint.h index 8391cad..578cf25 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/RegisterCheckpoint.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/RegisterCheckpoint.h @@ -10,8 +10,8 @@ #ifndef liblldb_RegisterCheckpoint_h_ #define liblldb_RegisterCheckpoint_h_ -#include "lldb/Core/UserID.h" #include "lldb/Target/StackID.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/RegisterContext.h b/contrib/llvm/tools/lldb/include/lldb/Target/RegisterContext.h index 485645b..c438a0c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/RegisterContext.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/RegisterContext.h @@ -138,12 +138,12 @@ public: virtual bool HardwareSingleStep(bool enable); - virtual Error + virtual Status ReadRegisterValueFromMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t src_addr, uint32_t src_len, RegisterValue ®_value); - virtual Error + virtual Status WriteRegisterValueToMemory(const lldb_private::RegisterInfo *reg_info, lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value); diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/RegisterNumber.h b/contrib/llvm/tools/lldb/include/lldb/Target/RegisterNumber.h index b3845ac..5649c80 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/RegisterNumber.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/RegisterNumber.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_RegisterNumber_h -#define liblldb_RegisterNumber_h +#ifndef LLDB_TARGET_REGISTERNUMBER_H +#define LLDB_TARGET_REGISTERNUMBER_H #include "lldb/lldb-private.h" #include <map> diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/SectionLoadList.h b/contrib/llvm/tools/lldb/include/lldb/Target/SectionLoadList.h index c232dd9..beb345b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/SectionLoadList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/SectionLoadList.h @@ -47,7 +47,8 @@ public: lldb::addr_t GetSectionLoadAddress(const lldb::SectionSP §ion_sp) const; - bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr) const; + bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, + bool allow_section_end = false) const; bool SetSectionLoadAddress(const lldb::SectionSP §ion_sp, lldb::addr_t load_addr, diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/StackFrame.h b/contrib/llvm/tools/lldb/include/lldb/Target/StackFrame.h index 34bd187..d970435 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/StackFrame.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/StackFrame.h @@ -17,15 +17,16 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" -#include "lldb/Core/Flags.h" +#include "lldb/Utility/Flags.h" + #include "lldb/Core/Scalar.h" -#include "lldb/Core/StreamString.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/ValueObjectList.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/StackID.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StreamString.h" +#include "lldb/Utility/UserID.h" namespace lldb_private { @@ -200,7 +201,7 @@ public: /// Returns true if the CFA value was successfully set in value. Some /// frames may be unable to provide this value; they will return false. //------------------------------------------------------------------ - bool GetFrameBaseValue(Scalar &value, Error *error_ptr); + bool GetFrameBaseValue(Scalar &value, Status *error_ptr); //------------------------------------------------------------------ /// Get the DWARFExpression corresponding to the Canonical Frame Address. @@ -214,7 +215,7 @@ public: /// @return /// Returns the corresponding DWARF expression, or NULL. //------------------------------------------------------------------ - DWARFExpression *GetFrameBaseExpression(Error *error_ptr); + DWARFExpression *GetFrameBaseExpression(Status *error_ptr); //------------------------------------------------------------------ /// Get the current lexical scope block for this StackFrame, if possible. @@ -314,7 +315,7 @@ public: //------------------------------------------------------------------ lldb::ValueObjectSP GetValueForVariableExpressionPath( llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, - uint32_t options, lldb::VariableSP &var_sp, Error &error); + uint32_t options, lldb::VariableSP &var_sp, Status &error); //------------------------------------------------------------------ /// Determine whether this StackFrame has debug information available or not @@ -341,10 +342,13 @@ public: /// @param [in] strm /// The Stream to print the description to. /// + /// @param [in] show_unique + /// Whether to print the function arguments or not for backtrace unique. + /// /// @param [in] frame_marker /// Optional string that will be prepended to the frame output description. //------------------------------------------------------------------ - void DumpUsingSettingsFormat(Stream *strm, + void DumpUsingSettingsFormat(Stream *strm, bool show_unique = false, const char *frame_marker = nullptr); //------------------------------------------------------------------ @@ -374,6 +378,10 @@ public: /// @param[in] show_source /// If true, print source or disassembly as per the user's settings. /// + /// @param[in] show_unique + /// If true, print using backtrace unique style, without function + /// arguments as per the user's settings. + /// /// @param[in] frame_marker /// Passed to DumpUsingSettingsFormat() for the frame info printing. /// @@ -381,7 +389,7 @@ public: /// Returns true if successful. //------------------------------------------------------------------ bool GetStatus(Stream &strm, bool show_frame_info, bool show_source, - const char *frame_marker = nullptr); + bool show_unique = false, const char *frame_marker = nullptr); //------------------------------------------------------------------ /// Query whether this frame is a concrete frame on the call stack, @@ -534,7 +542,7 @@ private: SymbolContext m_sc; Flags m_flags; Scalar m_frame_base; - Error m_frame_base_error; + Status m_frame_base_error; bool m_cfa_is_valid; // Does this frame have a CFA? Different from CFA == // LLDB_INVALID_ADDRESS uint32_t m_stop_id; diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/StackFrameList.h b/contrib/llvm/tools/lldb/include/lldb/Target/StackFrameList.h index a770346..cb9fb13 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/StackFrameList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/StackFrameList.h @@ -70,6 +70,7 @@ public: size_t GetStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, uint32_t num_frames_with_source, + bool show_unique = false, const char *frame_marker = nullptr); protected: diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/StopInfo.h b/contrib/llvm/tools/lldb/include/lldb/Target/StopInfo.h index 46f3456..c99877c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/StopInfo.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/StopInfo.h @@ -16,8 +16,8 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" #include "lldb/Target/Process.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-public.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/StructuredDataPlugin.h b/contrib/llvm/tools/lldb/include/lldb/Target/StructuredDataPlugin.h index aa4452a..5ea265b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/StructuredDataPlugin.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/StructuredDataPlugin.h @@ -11,7 +11,7 @@ #define StructuredDataPlugin_h #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" +#include "lldb/Utility/StructuredData.h" namespace lldb_private { @@ -123,8 +123,8 @@ public: /// The error if formatting the object contents failed; otherwise, /// success. // ------------------------------------------------------------------------- - virtual Error GetDescription(const StructuredData::ObjectSP &object_sp, - lldb_private::Stream &stream) = 0; + virtual Status GetDescription(const StructuredData::ObjectSP &object_sp, + lldb_private::Stream &stream) = 0; // ------------------------------------------------------------------------- /// Returns whether the plugin's features are enabled. diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/SystemRuntime.h b/contrib/llvm/tools/lldb/include/lldb/Target/SystemRuntime.h index 3a2a544..8c6c2ec 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/SystemRuntime.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/SystemRuntime.h @@ -16,12 +16,12 @@ // Project includes #include <vector> -#include "lldb/Core/ConstString.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginInterface.h" -#include "lldb/Core/StructuredData.h" #include "lldb/Target/QueueItem.h" #include "lldb/Target/QueueList.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/Target.h b/contrib/llvm/tools/lldb/include/lldb/Target/Target.h index 8d6fc77..ff94519 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/Target.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/Target.h @@ -82,6 +82,10 @@ public: bool SetPreferDynamicValue(lldb::DynamicValueType d); + bool GetPreloadSymbols() const; + + void SetPreloadSymbols(bool b); + bool GetDisableASLR() const; void SetDisableASLR(bool b); @@ -486,7 +490,7 @@ public: // UpdateInstanceName (); lldb::ModuleSP GetSharedModule(const ModuleSpec &module_spec, - Error *error_ptr = nullptr); + Status *error_ptr = nullptr); //---------------------------------------------------------------------- // Settings accessors @@ -524,11 +528,11 @@ public: void Destroy(); - Error Launch(ProcessLaunchInfo &launch_info, - Stream *stream); // Optional stream to receive first stop info + Status Launch(ProcessLaunchInfo &launch_info, + Stream *stream); // Optional stream to receive first stop info - Error Attach(ProcessAttachInfo &attach_info, - Stream *stream); // Optional stream to receive first stop info + Status Attach(ProcessAttachInfo &attach_info, + Stream *stream); // Optional stream to receive first stop info //------------------------------------------------------------------ // This part handles the breakpoints. @@ -607,7 +611,7 @@ public: CreateExceptionBreakpoint(enum lldb::LanguageType language, bool catch_bp, bool throw_bp, bool internal, Args *additional_args = nullptr, - Error *additional_args_error = nullptr); + Status *additional_args_error = nullptr); // This is the same as the func_name breakpoint except that you can specify a // vector of names. This is cheaper @@ -640,7 +644,7 @@ public: // Use this to create a watchpoint: lldb::WatchpointSP CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, - Error &error); + Status &error); lldb::WatchpointSP GetLastCreatedWatchpoint() { return m_last_created_watchpoint; @@ -683,15 +687,16 @@ public: bool IgnoreWatchpointByID(lldb::watch_id_t watch_id, uint32_t ignore_count); - Error SerializeBreakpointsToFile(const FileSpec &file, - const BreakpointIDList &bp_ids, bool append); + Status SerializeBreakpointsToFile(const FileSpec &file, + const BreakpointIDList &bp_ids, + bool append); - Error CreateBreakpointsFromFile(const FileSpec &file, - BreakpointIDList &new_bps); + Status CreateBreakpointsFromFile(const FileSpec &file, + BreakpointIDList &new_bps); - Error CreateBreakpointsFromFile(const FileSpec &file, - std::vector<std::string> &names, - BreakpointIDList &new_bps); + Status CreateBreakpointsFromFile(const FileSpec &file, + std::vector<std::string> &names, + BreakpointIDList &new_bps); //------------------------------------------------------------------ /// Get \a load_addr as a callable code load address for this target @@ -804,7 +809,7 @@ public: //------------------------------------------------------------------ void SetExecutableModule(lldb::ModuleSP &module_sp, bool get_dependent_files); - bool LoadScriptingResources(std::list<Error> &errors, + bool LoadScriptingResources(std::list<Status> &errors, Stream *feedback_stream = nullptr, bool continue_on_error = true) { return m_images.LoadScriptingResourcesInTarget( @@ -910,7 +915,7 @@ public: Debugger &GetDebugger() { return m_debugger; } size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len, - Error &error); + Status &error); // Reading memory through the target allows us to skip going to the process // for reading memory if possible and it allows us to try and read from @@ -923,27 +928,27 @@ public: // 2 - if there is a valid process, try and read from its memory // 3 - if (prefer_file_cache == false) then read from object file cache size_t ReadMemory(const Address &addr, bool prefer_file_cache, void *dst, - size_t dst_len, Error &error, + size_t dst_len, Status &error, lldb::addr_t *load_addr_ptr = nullptr); size_t ReadCStringFromMemory(const Address &addr, std::string &out_str, - Error &error); + Status &error); size_t ReadCStringFromMemory(const Address &addr, char *dst, - size_t dst_max_len, Error &result_error); + size_t dst_max_len, Status &result_error); size_t ReadScalarIntegerFromMemory(const Address &addr, bool prefer_file_cache, uint32_t byte_size, bool is_signed, Scalar &scalar, - Error &error); + Status &error); uint64_t ReadUnsignedIntegerFromMemory(const Address &addr, bool prefer_file_cache, size_t integer_byte_size, - uint64_t fail_value, Error &error); + uint64_t fail_value, Status &error); bool ReadPointerFromMemory(const Address &addr, bool prefer_file_cache, - Error &error, Address &pointer_addr); + Status &error, Address &pointer_addr); SectionLoadList &GetSectionLoadList() { return m_section_load_history.GetCurrentSectionLoadList(); @@ -974,7 +979,7 @@ public: PathMappingList &GetImageSearchPathList(); - TypeSystem *GetScratchTypeSystemForLanguage(Error *error, + TypeSystem *GetScratchTypeSystemForLanguage(Status *error, lldb::LanguageType language, bool create_on_demand = true); @@ -989,7 +994,7 @@ public: UserExpression *GetUserExpressionForLanguage( llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, Expression::ResultType desired_type, - const EvaluateExpressionOptions &options, Error &error); + const EvaluateExpressionOptions &options, Status &error); // Creates a FunctionCaller for the given language, the rest of the parameters // have the @@ -1004,7 +1009,7 @@ public: const CompilerType &return_type, const Address &function_address, const ValueList &arg_value_list, - const char *name, Error &error); + const char *name, Status &error); // Creates a UtilityFunction for the given language, the rest of the // parameters have the @@ -1014,7 +1019,7 @@ public: UtilityFunction *GetUtilityFunctionForLanguage(const char *expr, lldb::LanguageType language, const char *name, - Error &error); + Status &error); ClangASTContext *GetScratchClangASTContext(bool create_on_demand = true); @@ -1024,7 +1029,7 @@ public: // Install any files through the platform that need be to installed // prior to launching or attaching. //---------------------------------------------------------------------- - Error Install(ProcessLaunchInfo *launch_info); + Status Install(ProcessLaunchInfo *launch_info); bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr); @@ -1179,7 +1184,7 @@ public: GetSearchFilterForModuleAndCUList(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles); - lldb::REPLSP GetREPL(Error &err, lldb::LanguageType language, + lldb::REPLSP GetREPL(Status &err, lldb::LanguageType language, const char *repl_options, bool can_create); void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp); diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/TargetList.h b/contrib/llvm/tools/lldb/include/lldb/Target/TargetList.h index 81b81db..43f4520 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/TargetList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/TargetList.h @@ -91,10 +91,10 @@ public: /// @return /// An error object that indicates success or failure //------------------------------------------------------------------ - Error CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, - llvm::StringRef triple_str, bool get_dependent_modules, - const OptionGroupPlatform *platform_options, - lldb::TargetSP &target_sp); + Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, + llvm::StringRef triple_str, bool get_dependent_modules, + const OptionGroupPlatform *platform_options, + lldb::TargetSP &target_sp); //------------------------------------------------------------------ /// Create a new Target. @@ -102,9 +102,9 @@ public: /// Same as the function above, but used when you already know the /// platform you will be using //------------------------------------------------------------------ - Error CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, - const ArchSpec &arch, bool get_dependent_modules, - lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp); + Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, + const ArchSpec &arch, bool get_dependent_modules, + lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp); //------------------------------------------------------------------ /// Delete a Target object from the list. @@ -211,20 +211,20 @@ protected: private: lldb::TargetSP GetDummyTarget(lldb_private::Debugger &debugger); - Error CreateDummyTarget(Debugger &debugger, - llvm::StringRef specified_arch_name, - lldb::TargetSP &target_sp); + Status CreateDummyTarget(Debugger &debugger, + llvm::StringRef specified_arch_name, + lldb::TargetSP &target_sp); - Error CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, - llvm::StringRef triple_str, - bool get_dependent_files, - const OptionGroupPlatform *platform_options, - lldb::TargetSP &target_sp, bool is_dummy_target); + Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, + llvm::StringRef triple_str, + bool get_dependent_files, + const OptionGroupPlatform *platform_options, + lldb::TargetSP &target_sp, bool is_dummy_target); - Error CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, - const ArchSpec &arch, bool get_dependent_modules, - lldb::PlatformSP &platform_sp, - lldb::TargetSP &target_sp, bool is_dummy_target); + Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path, + const ArchSpec &arch, bool get_dependent_modules, + lldb::PlatformSP &platform_sp, + lldb::TargetSP &target_sp, bool is_dummy_target); DISALLOW_COPY_AND_ASSIGN(TargetList); }; diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/Thread.h b/contrib/llvm/tools/lldb/include/lldb/Target/Thread.h index 63449bb..1b0b6ef 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/Thread.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/Thread.h @@ -21,12 +21,12 @@ // Project includes #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Event.h" -#include "lldb/Core/StructuredData.h" -#include "lldb/Core/UserID.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/RegisterCheckpoint.h" #include "lldb/Target/StackFrameList.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" #define LLDB_THREAD_MAX_STOP_EXC_DATA 8 @@ -126,6 +126,7 @@ public: // bit of data. lldb::StopInfoSP stop_info_sp; // You have to restore the stop info or you // might continue with the wrong signals. + std::vector<lldb::ThreadPlanSP> m_completed_plan_stack; lldb::RegisterCheckpointSP register_backup_sp; // You need to restore the registers, of course... uint32_t current_inlined_depth; @@ -440,16 +441,16 @@ public: return GetStackFrameList()->GetCurrentInlinedDepth(); } - Error ReturnFromFrameWithIndex(uint32_t frame_idx, - lldb::ValueObjectSP return_value_sp, - bool broadcast = false); + Status ReturnFromFrameWithIndex(uint32_t frame_idx, + lldb::ValueObjectSP return_value_sp, + bool broadcast = false); - Error ReturnFromFrame(lldb::StackFrameSP frame_sp, - lldb::ValueObjectSP return_value_sp, - bool broadcast = false); + Status ReturnFromFrame(lldb::StackFrameSP frame_sp, + lldb::ValueObjectSP return_value_sp, + bool broadcast = false); - Error JumpToLine(const FileSpec &file, uint32_t line, bool can_leave_function, - std::string *warnings = nullptr); + Status JumpToLine(const FileSpec &file, uint32_t line, + bool can_leave_function, std::string *warnings = nullptr); virtual lldb::StackFrameSP GetFrameWithStackID(const StackID &stack_id) { if (stack_id.IsValid()) @@ -529,7 +530,7 @@ public: /// @return /// An error that describes anything that went wrong //------------------------------------------------------------------ - virtual Error + virtual Status StepIn(bool source_step, LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); @@ -547,7 +548,7 @@ public: /// @return /// An error that describes anything that went wrong //------------------------------------------------------------------ - virtual Error StepOver( + virtual Status StepOver( bool source_step, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); @@ -560,7 +561,7 @@ public: /// @return /// An error that describes anything that went wrong //------------------------------------------------------------------ - virtual Error StepOut(); + virtual Status StepOut(); //------------------------------------------------------------------ /// Retrieves the per-thread data area. @@ -972,7 +973,7 @@ public: /// An error if the thread plan could not be unwound. //------------------------------------------------------------------ - Error UnwindInnermostExpression(); + Status UnwindInnermostExpression(); //------------------------------------------------------------------ /// Gets the outer-most plan that was popped off the plan stack in the @@ -1029,6 +1030,15 @@ public: bool WasThreadPlanDiscarded(ThreadPlan *plan); //------------------------------------------------------------------ + /// Check if we have completed plan to override breakpoint stop reason + /// + /// @return + /// Returns true if completed plan stack is not empty + /// false otherwise. + //------------------------------------------------------------------ + bool CompletedPlanOverridesBreakpoint(); + + //------------------------------------------------------------------ /// Queues a generic thread plan. /// /// @param[in] plan_sp @@ -1153,8 +1163,8 @@ public: GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr); size_t GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames, - uint32_t num_frames_with_source, - bool stop_format); + uint32_t num_frames_with_source, bool stop_format, + bool only_stacks = false); size_t GetStackFrameStatus(Stream &strm, uint32_t first_frame, uint32_t num_frames, bool show_frame_info, @@ -1213,6 +1223,8 @@ public: void SetStopInfo(const lldb::StopInfoSP &stop_info_sp); + void ResetStopInfo(); + void SetShouldReportStop(Vote vote); //---------------------------------------------------------------------- diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadList.h b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadList.h index 9e3c940..2ebcd0b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadList.h @@ -13,10 +13,10 @@ #include <mutex> #include <vector> -#include "lldb/Core/UserID.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadCollection.h" #include "lldb/Utility/Iterable.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlan.h b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlan.h index fd25cd0..acc63ff 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlan.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlan.h @@ -17,12 +17,12 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/UserID.h" #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanTracer.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { @@ -40,9 +40,10 @@ namespace lldb_private { // The thread maintaining a thread plan stack, and you program the actions of a // particular thread // by pushing plans onto the plan stack. -// There is always a "Current" plan, which is the head of the plan stack, +// There is always a "Current" plan, which is the top of the plan stack, // though in some cases -// a plan may defer to plans higher in the stack for some piece of information. +// a plan may defer to plans higher in the stack for some piece of information +// (let us define that the plan stack grows downwards). // // The plan stack is never empty, there is always a Base Plan which persists // through the life @@ -109,6 +110,15 @@ namespace lldb_private { // plans in the time between when // your plan gets unshipped and the next resume. // +// Thread State Checkpoint: +// +// Note that calling functions on target process (ThreadPlanCallFunction) changes +// current thread state. The function can be called either by direct user demand or +// internally, for example lldb allocates memory on device to calculate breakpoint +// condition expression - on Linux it is performed by calling mmap on device. +// ThreadStateCheckpoint saves Thread state (stop info and completed +// plan stack) to restore it after completing function call. +// // Over the lifetime of the plan, various methods of the ThreadPlan are then // called in response to changes of state in // the process we are debugging as follows: @@ -149,7 +159,7 @@ namespace lldb_private { // If the Current plan answers "true" then it is asked if the stop should // percolate all the way to the // user by calling the ShouldStop method. If the current plan doesn't explain -// the stop, then we query down +// the stop, then we query up // the plan stack for a plan that does explain the stop. The plan that does // explain the stop then needs to // figure out what to do about the plans below it in the stack. If the stop is @@ -170,7 +180,7 @@ namespace lldb_private { // event it didn't directly handle // it can designate itself a "Master" plan by responding true to IsMasterPlan, // and then if it wants not to be -// discarded, it can return true to OkayToDiscard, and it and all its dependent +// discarded, it can return false to OkayToDiscard, and it and all its dependent // plans will be preserved when // we resume execution. // @@ -207,7 +217,7 @@ namespace lldb_private { // // If a plan says responds "true" to ShouldStop, then it is asked if it's job // is complete by calling -// MischiefManaged. If that returns true, the thread is popped from the plan +// MischiefManaged. If that returns true, the plan is popped from the plan // stack and added to the // Completed Plan Stack. Then the next plan in the stack is asked if it // ShouldStop, and it returns "true", @@ -241,9 +251,9 @@ namespace lldb_private { // // When the process stops, the thread is given a StopReason, in the form of a // StopInfo object. If there is a completed -// plan corresponding to the stop, then the "actual" stop reason will be +// plan corresponding to the stop, then the "actual" stop reason can be // suppressed, and instead a StopInfoThreadPlan -// object will be cons'ed up from the highest completed plan in the stack. +// object will be cons'ed up from the top completed plan in the stack. // However, if the plan doesn't want to be // the stop reason, then it can call SetPlanComplete and pass in "false" for // the "success" parameter. In that case, diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallFunction.h index 3d43491..1c75b0a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallFunction.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallFunction.h @@ -117,7 +117,7 @@ protected: lldb::addr_t &start_load_addr, lldb::addr_t &function_load_addr); - void DoTakedown(bool success); + virtual void DoTakedown(bool success); void SetBreakpoints(); diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallUserExpression.h b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallUserExpression.h index f1425b2..5fe8092 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallUserExpression.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanCallUserExpression.h @@ -35,6 +35,8 @@ public: void GetDescription(Stream *s, lldb::DescriptionLevel level) override; + void DidPush() override; + void WillPop() override; lldb::StopInfoSP GetRealStopInfo() override; @@ -48,6 +50,7 @@ public: } protected: + void DoTakedown(bool success) override; private: lldb::UserExpressionSP m_user_expression_sp; // This is currently just used to ensure the diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanPython.h b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanPython.h index a053b5b..973c935 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanPython.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadPlanPython.h @@ -17,14 +17,14 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/StructuredData.h" -#include "lldb/Core/UserID.h" #include "lldb/Target/Process.h" #include "lldb/Target/StopInfo.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlan.h" #include "lldb/Target/ThreadPlanTracer.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/Utility/UserID.h" #include "lldb/lldb-private.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadSpec.h b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadSpec.h index 204f1f9..34baf80 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/ThreadSpec.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/ThreadSpec.h @@ -10,13 +10,9 @@ #ifndef liblldb_ThreadSpec_h_ #define liblldb_ThreadSpec_h_ -// C Includes -// C++ Includes -#include <string> - -// Other libraries and framework includes -// Project includes +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-private.h" +#include <string> namespace lldb_private { @@ -45,7 +41,7 @@ public: static std::unique_ptr<ThreadSpec> CreateFromStructuredData(const StructuredData::Dictionary &data_dict, - Error &error); + Status &error); StructuredData::ObjectSP SerializeToStructuredData(); @@ -55,9 +51,9 @@ public: void SetTID(lldb::tid_t tid) { m_tid = tid; } - void SetName(const char *name) { m_name = name; } + void SetName(llvm::StringRef name) { m_name = name; } - void SetQueueName(const char *queue_name) { m_queue_name = queue_name; } + void SetQueueName(llvm::StringRef queue_name) { m_queue_name = queue_name; } uint32_t GetIndex() const { return m_index; } diff --git a/contrib/llvm/tools/lldb/include/lldb/Target/UnixSignals.h b/contrib/llvm/tools/lldb/include/lldb/Target/UnixSignals.h index 1c58d64..a209f35 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Target/UnixSignals.h +++ b/contrib/llvm/tools/lldb/include/lldb/Target/UnixSignals.h @@ -14,11 +14,13 @@ // C++ Includes #include <map> #include <string> +#include <vector> // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" +#include "lldb/Utility/ConstString.h" #include "lldb/lldb-private.h" +#include "llvm/ADT/Optional.h" namespace lldb_private { @@ -88,6 +90,19 @@ public: void RemoveSignal(int signo); + // Returns a current version of the data stored in this class. + // Version gets incremented each time Set... method is called. + uint64_t GetVersion() const; + + // Returns a vector of signals that meet criteria provided in arguments. + // Each should_[suppress|stop|notify] flag can be + // None - no filtering by this flag + // true - only signals that have it set to true are returned + // false - only signals that have it set to true are returned + std::vector<int32_t> GetFilteredSignals(llvm::Optional<bool> should_suppress, + llvm::Optional<bool> should_stop, + llvm::Optional<bool> should_notify); + protected: //------------------------------------------------------------------ // Classes that inherit from UnixSignals can see and modify these @@ -111,6 +126,12 @@ protected: collection m_signals; + // This version gets incremented every time something is changing in + // this class, including when we call AddSignal from the constructor. + // So after the object is constructed m_version is going to be > 0 + // if it has at least one signal registered in it. + uint64_t m_version = 0; + // GDBRemote signals need to be copyable. UnixSignals(const UnixSignals &rhs); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Baton.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Baton.h index c2ab9f7..065f296 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Baton.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Baton.h @@ -10,12 +10,15 @@ #ifndef lldb_Baton_h_ #define lldb_Baton_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes +#include "lldb/lldb-enumerations.h" // for DescriptionLevel #include "lldb/lldb-public.h" +#include <memory> // for unique_ptr + +namespace lldb_private { +class Stream; +} + namespace lldb_private { //---------------------------------------------------------------------- diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Connection.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Connection.h index 6ff7b00..be5641d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Connection.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Connection.h @@ -10,19 +10,28 @@ #ifndef liblldb_Connection_h_ #define liblldb_Connection_h_ -// Other libraries and framework includes -// Project includes -#include "lldb/Utility/Timeout.h" -#include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ConnectionStatus +#include "lldb/lldb-forward.h" // for IOObjectSP -// C Includes -// C++ Includes +#include "llvm/ADT/StringRef.h" // for StringRef + +#include <ratio> // for micro #include <string> +#include <stddef.h> // for size_t + +namespace lldb_private { +class Status; +} +namespace lldb_private { +template <typename Ratio> class Timeout; +} + namespace lldb_private { //---------------------------------------------------------------------- -/// @class Connection Connection.h "lldb/Core/Connection.h" +/// @class Connection Connection.h "lldb/Utility/Connection.h" /// @brief A communication connection class. /// /// A class that implements that actual communication functions for @@ -39,7 +48,7 @@ public: //------------------------------------------------------------------ /// Default constructor //------------------------------------------------------------------ - Connection(); + Connection() = default; //------------------------------------------------------------------ /// Virtual destructor since this class gets subclassed and handed @@ -47,8 +56,6 @@ public: //------------------------------------------------------------------ virtual ~Connection(); - static Connection *CreateDefaultConnection(const char *url); - //------------------------------------------------------------------ /// Connect using the connect string \a url. /// @@ -66,10 +73,10 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); //------------------------------------------------------------------ virtual lldb::ConnectionStatus Connect(llvm::StringRef url, - Error *error_ptr) = 0; + Status *error_ptr) = 0; //------------------------------------------------------------------ /// Disconnect the communications connection if one is currently @@ -85,9 +92,9 @@ public: /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Error& Communication::GetError (); + /// @see Status& Communication::GetError (); //------------------------------------------------------------------ - virtual lldb::ConnectionStatus Disconnect(Error *error_ptr) = 0; + virtual lldb::ConnectionStatus Disconnect(Status *error_ptr) = 0; //------------------------------------------------------------------ /// Check if the connection is valid. @@ -128,7 +135,7 @@ public: //------------------------------------------------------------------ virtual size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, - lldb::ConnectionStatus &status, Error *error_ptr) = 0; + lldb::ConnectionStatus &status, Status *error_ptr) = 0; //------------------------------------------------------------------ /// The actual write function that attempts to write to the @@ -153,7 +160,7 @@ public: /// The number of bytes actually Written. //------------------------------------------------------------------ virtual size_t Write(const void *dst, size_t dst_len, - lldb::ConnectionStatus &status, Error *error_ptr) = 0; + lldb::ConnectionStatus &status, Status *error_ptr) = 0; //------------------------------------------------------------------ /// Returns a URI that describes this connection object diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/ConstString.h b/contrib/llvm/tools/lldb/include/lldb/Utility/ConstString.h index c6531ca..fbf1a9b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/ConstString.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/ConstString.h @@ -10,18 +10,22 @@ #ifndef liblldb_ConstString_h_ #define liblldb_ConstString_h_ -// C Includes -// C++ Includes -// Other libraries and framework includes #include "llvm/ADT/StringRef.h" +#include "llvm/Support/FormatVariadic.h" // for format_provider -// Project includes -#include "lldb/lldb-private.h" +#include <stddef.h> // for size_t + +namespace lldb_private { +class Stream; +} +namespace llvm { +class raw_ostream; +} namespace lldb_private { //---------------------------------------------------------------------- -/// @class ConstString ConstString.h "lldb/Core/ConstString.h" +/// @class ConstString ConstString.h "lldb/Utility/ConstString.h" /// @brief A uniqued constant string class. /// /// Provides an efficient way to store strings as uniqued strings. After @@ -476,4 +480,11 @@ Stream &operator<<(Stream &s, const ConstString &str); } // namespace lldb_private +namespace llvm { +template <> struct format_provider<lldb_private::ConstString> { + static void format(const lldb_private::ConstString &CS, llvm::raw_ostream &OS, + llvm::StringRef Options); +}; +} + #endif // liblldb_ConstString_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/ConvertEnum.h b/contrib/llvm/tools/lldb/include/lldb/Utility/ConvertEnum.h deleted file mode 100644 index 239247d..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/ConvertEnum.h +++ /dev/null @@ -1,21 +0,0 @@ -//===-- ConvertEnum.h -------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -#ifndef LLDB_UTILITY_CONVERTENUM_H -#define LLDB_UTILITY_CONVERTENUM_H - -#include "lldb/lldb-enumerations.h" -#include "lldb/lldb-private-enumerations.h" - -namespace lldb_private { - -const char *GetVoteAsCString(Vote vote); -const char *GetSectionTypeAsCString(lldb::SectionType sect_type); -} - -#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/DataBuffer.h b/contrib/llvm/tools/lldb/include/lldb/Utility/DataBuffer.h index ffa71c0..ffa71c0 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/DataBuffer.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/DataBuffer.h diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/DataBufferHeap.h b/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferHeap.h index 5528ebd..20e27ef 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/DataBufferHeap.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferHeap.h @@ -10,10 +10,12 @@ #ifndef liblldb_DataBufferHeap_h_ #define liblldb_DataBufferHeap_h_ -#include <vector> +#include "lldb/Utility/DataBuffer.h" +#include "lldb/lldb-types.h" // for offset_t +#include "llvm/ADT/StringRef.h" // for StringRef -#include "lldb/Core/DataBuffer.h" -#include "lldb/lldb-private.h" +#include <cstdint> // for uint8_t, uint64_t +#include <vector> namespace lldb_private { @@ -25,7 +27,8 @@ namespace lldb_private { /// the object. This class is best used to store chunks of data that /// are created or read from sources that can't intelligently and lazily /// fault new data pages in. Large amounts of data that comes from files -/// should probably use the DataBufferMemoryMap class. +/// should probably use DataBufferLLVM, which can intelligently determine +/// when memory mapping is optimal. //---------------------------------------------------------------------- class DataBufferHeap : public DataBuffer { public: diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferLLVM.h b/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferLLVM.h new file mode 100644 index 0000000..737e2d0 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/DataBufferLLVM.h @@ -0,0 +1,52 @@ +//===--- DataBufferLLVM.h ---------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_CORE_DATABUFFERLLVM_H +#define LLDB_CORE_DATABUFFERLLVM_H + +#include "lldb/Utility/DataBuffer.h" +#include "lldb/lldb-types.h" // for offset_t + +#include <memory> +#include <stdint.h> // for uint8_t, uint64_t + +namespace llvm { +class MemoryBuffer; +class Twine; +} + +namespace lldb_private { + +class DataBufferLLVM : public DataBuffer { +public: + ~DataBufferLLVM(); + + static std::shared_ptr<DataBufferLLVM> + CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, uint64_t Offset, bool Private = false); + + static std::shared_ptr<DataBufferLLVM> + CreateFromPath(const llvm::Twine &Path, bool NullTerminate = false, bool Private = false); + + uint8_t *GetBytes() override; + const uint8_t *GetBytes() const override; + lldb::offset_t GetByteSize() const override; + + char *GetChars() { return reinterpret_cast<char *>(GetBytes()); } + +private: + /// \brief Construct a DataBufferLLVM from \p Buffer. \p Buffer must be a + /// valid pointer. + explicit DataBufferLLVM(std::unique_ptr<llvm::MemoryBuffer> Buffer); + const uint8_t *GetBuffer() const; + + std::unique_ptr<llvm::MemoryBuffer> Buffer; +}; +} + +#endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/DataEncoder.h b/contrib/llvm/tools/lldb/include/lldb/Utility/DataEncoder.h index a2bc4dc..ea347d8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/DataEncoder.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/DataEncoder.h @@ -12,8 +12,12 @@ #if defined(__cplusplus) -#include "lldb/lldb-private.h" -#include <limits.h> +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN +#include "lldb/lldb-enumerations.h" // for ByteOrder +#include "lldb/lldb-forward.h" // for DataBufferSP +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t #include <stdint.h> namespace lldb_private { @@ -384,9 +388,9 @@ protected: lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from. uint8_t m_addr_size; ///< The address size to use when extracting pointers or - ///addresses + /// addresses mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can - ///be shared among multiple instances + /// be shared among multiple instances private: DISALLOW_COPY_AND_ASSIGN(DataEncoder); diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/DataExtractor.h b/contrib/llvm/tools/lldb/include/lldb/Utility/DataExtractor.h index 89cc005..4ef78c1 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/DataExtractor.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/DataExtractor.h @@ -7,20 +7,29 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_DataExtractor_h_ -#define liblldb_DataExtractor_h_ +#ifndef LLDB_UTILITY_DATAEXTRACTOR_H +#define LLDB_UTILITY_DATAEXTRACTOR_H -// C Includes -#include <limits.h> +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder +#include "lldb/lldb-forward.h" // for DataBufferSP +#include "lldb/lldb-types.h" + +#include <cassert> #include <stdint.h> #include <string.h> -// C++ Includes -// Other libraries and framework includes -#include "llvm/ADT/SmallVector.h" +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Stream; +} +namespace llvm { +template <typename T> class SmallVectorImpl; +} -// Project includes -#include "lldb/lldb-private.h" +// C++ Includes namespace lldb_private { @@ -43,8 +52,6 @@ public: //------------------------------------------------------------------ /// @typedef DataExtractor::Type /// @brief Type enumerations used in the dump routines. - /// @see DataExtractor::Dump() - /// @see DataExtractor::DumpRawHexBytes() //------------------------------------------------------------------ typedef enum { TypeUInt8, ///< Format output as unsigned 8 bit integers @@ -57,12 +64,6 @@ public: TypeSLEB128 ///< Format output as SLEB128 numbers } Type; - static void DumpHexBytes(Stream *s, const void *src, size_t src_len, - uint32_t bytes_per_line, - lldb::addr_t base_addr); // Pass LLDB_INVALID_ADDRESS - // to not show address at - // start of line - //------------------------------------------------------------------ /// Default constructor. /// @@ -172,7 +173,9 @@ public: /// reference count on the data will be decremented, and if zero, /// the data will be freed. //------------------------------------------------------------------ - ~DataExtractor(); + virtual ~DataExtractor(); + + uint32_t getTargetByteSize() const { return m_target_byte_size; } //------------------------------------------------------------------ /// Clears the object state. @@ -225,73 +228,6 @@ public: const char *type_format = nullptr) const; //------------------------------------------------------------------ - /// Dumps \a item_count objects into the stream \a s. - /// - /// Dumps \a item_count objects using \a item_format, each of which - /// are \a item_byte_size bytes long starting at offset \a offset - /// bytes into the contained data, into the stream \a s. \a - /// num_per_line objects will be dumped on each line before a new - /// line will be output. If \a base_addr is a valid address, then - /// each new line of output will be preceded by the address value - /// plus appropriate offset, and a colon and space. Bitfield values - /// can be dumped by calling this function multiple times with the - /// same start offset, format and size, yet differing \a - /// item_bit_size and \a item_bit_offset values. - /// - /// @param[in] s - /// The stream to dump the output to. This value can not be nullptr. - /// - /// @param[in] offset - /// The offset into the data at which to start dumping. - /// - /// @param[in] item_format - /// The format to use when dumping each item. - /// - /// @param[in] item_byte_size - /// The byte size of each item. - /// - /// @param[in] item_count - /// The number of items to dump. - /// - /// @param[in] num_per_line - /// The number of items to display on each line. - /// - /// @param[in] base_addr - /// The base address that gets added to the offset displayed on - /// each line if the value is valid. Is \a base_addr is - /// LLDB_INVALID_ADDRESS then no address values will be prepended - /// to any lines. - /// - /// @param[in] item_bit_size - /// If the value to display is a bitfield, this value should - /// be the number of bits that the bitfield item has within the - /// item's byte size value. This function will need to be called - /// multiple times with identical \a offset and \a item_byte_size - /// values in order to display multiple bitfield values that - /// exist within the same integer value. If the items being - /// displayed are not bitfields, this value should be zero. - /// - /// @param[in] item_bit_offset - /// If the value to display is a bitfield, this value should - /// be the offset in bits, or shift right amount, that the - /// bitfield item occupies within the item's byte size value. - /// This function will need to be called multiple times with - /// identical \a offset and \a item_byte_size values in order - /// to display multiple bitfield values that exist within the - /// same integer value. If the items being displayed are not - /// bitfields, this value should be zero. - /// - /// @return - /// The offset at which dumping ended. - //------------------------------------------------------------------ - lldb::offset_t Dump(Stream *s, lldb::offset_t offset, - lldb::Format item_format, size_t item_byte_size, - size_t item_count, size_t num_per_line, - uint64_t base_addr, uint32_t item_bit_size, - uint32_t item_bit_offset, - ExecutionContextScope *exe_scope = nullptr) const; - - //------------------------------------------------------------------ /// Dump a UUID value at \a offset. /// /// Dump a UUID starting at \a offset bytes into this object's data. @@ -573,38 +509,6 @@ public: long double GetLongDouble(lldb::offset_t *offset_ptr) const; //------------------------------------------------------------------ - /// Extract a GNU encoded pointer value from \a *offset_ptr. - /// - /// @param[in,out] offset_ptr - /// A pointer to an offset within the data that will be advanced - /// by the appropriate number of bytes if the value is extracted - /// correctly. If the offset is out of bounds or there are not - /// enough bytes to extract this value, the offset will be left - /// unmodified. - /// - /// @param[in] eh_ptr_enc - /// The GNU pointer encoding type. - /// - /// @param[in] pc_rel_addr - /// The PC relative address to use when the encoding is - /// \c DW_GNU_EH_PE_pcrel. - /// - /// @param[in] text_addr - /// The text (code) relative address to use when the encoding is - /// \c DW_GNU_EH_PE_textrel. - /// - /// @param[in] data_addr - /// The data relative address to use when the encoding is - /// \c DW_GNU_EH_PE_datarel. - /// - /// @return - /// The extracted GNU encoded pointer value. - //------------------------------------------------------------------ - uint64_t GetGNUEHPointer(lldb::offset_t *offset_ptr, uint32_t eh_ptr_enc, - lldb::addr_t pc_rel_addr, lldb::addr_t text_addr, - lldb::addr_t data_addr); - - //------------------------------------------------------------------ /// Extract an integer of size \a byte_size from \a *offset_ptr. /// /// Extract a single integer value and update the offset pointed to @@ -1243,9 +1147,9 @@ protected: lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from. uint32_t m_addr_size; ///< The address size to use when extracting pointers or - ///addresses + /// addresses mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can - ///be shared among multiple instances + /// be shared among multiple instances const uint32_t m_target_byte_size; }; diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/Endian.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Endian.h index 82bc0b7..2a102b6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/Endian.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Endian.h @@ -7,11 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_host_endian_h_ -#define liblldb_host_endian_h_ +#ifndef LLDB_UTILITY_ENDIAN_H +#define LLDB_UTILITY_ENDIAN_H #include "lldb/lldb-enumerations.h" +#include <stdint.h> + namespace lldb_private { namespace endian { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/FastDemangle.h b/contrib/llvm/tools/lldb/include/lldb/Utility/FastDemangle.h index f779aaa..f779aaa 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/FastDemangle.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/FastDemangle.h diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/FileSpec.h b/contrib/llvm/tools/lldb/include/lldb/Utility/FileSpec.h index b8df745..67926d0 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/FileSpec.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/FileSpec.h @@ -17,13 +17,28 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/STLUtils.h" -#include "lldb/Host/PosixApi.h" -#include "lldb/lldb-private.h" +#include "lldb/Utility/ConstString.h" +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/FileSystem.h" #include "llvm/Support/FormatVariadic.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t + +namespace lldb_private { +class Stream; +} +namespace llvm { +class Triple; +} +namespace llvm { +class raw_ostream; +} +namespace llvm { +template <typename T> class SmallVectorImpl; +} + namespace lldb_private { //---------------------------------------------------------------------- @@ -46,17 +61,6 @@ namespace lldb_private { //---------------------------------------------------------------------- class FileSpec { public: - typedef enum FileType { - eFileTypeInvalid = -1, - eFileTypeUnknown = 0, - eFileTypeDirectory, - eFileTypePipe, - eFileTypeRegular, - eFileTypeSocket, - eFileTypeSymbolicLink, - eFileTypeOther - } FileType; - enum PathSyntax { ePathSyntaxPosix, ePathSyntaxWindows, @@ -85,7 +89,8 @@ public: explicit FileSpec(llvm::StringRef path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative); - explicit FileSpec(llvm::StringRef path, bool resolve_path, ArchSpec arch); + explicit FileSpec(llvm::StringRef path, bool resolve_path, + const llvm::Triple &Triple); //------------------------------------------------------------------ /// Copy constructor @@ -454,8 +459,6 @@ public: //------------------------------------------------------------------ ConstString GetFileNameStrippingExtension() const; - FileType GetFileType() const; - //------------------------------------------------------------------ /// Return the current permissions of the path. /// @@ -470,20 +473,6 @@ public: //------------------------------------------------------------------ uint32_t GetPermissions() const; - bool IsDirectory() const { - return GetFileType() == FileSpec::eFileTypeDirectory; - } - - bool IsPipe() const { return GetFileType() == FileSpec::eFileTypePipe; } - - bool IsRegularFile() const { - return GetFileType() == FileSpec::eFileTypeRegular; - } - - bool IsSocket() const { return GetFileType() == FileSpec::eFileTypeSocket; } - - bool IsSymbolicLink() const; - //------------------------------------------------------------------ /// Get the memory cost of this object. /// @@ -499,124 +488,6 @@ public: size_t MemorySize() const; //------------------------------------------------------------------ - /// Memory map part of, or the entire contents of, a file. - /// - /// Returns a shared pointer to a data buffer that contains all or - /// part of the contents of a file. The data is memory mapped and - /// will lazily page in data from the file as memory is accessed. - /// The data that is mapped will start \a offset bytes into the - /// file, and \a length bytes will be mapped. If \a length is - /// greater than the number of bytes available in the file starting - /// at \a offset, the number of bytes will be appropriately - /// truncated. The final number of bytes that get mapped can be - /// verified using the DataBuffer::GetByteSize() function on the return - /// shared data pointer object contents. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// A shared pointer to the memory mapped data. This shared - /// pointer can contain a nullptr DataBuffer pointer, so the contained - /// pointer must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP MemoryMapFileContents(off_t offset = 0, - size_t length = SIZE_MAX) const; - - //------------------------------------------------------------------ - /// Memory map part of, or the entire contents of, a file only if - /// the file is local (not on a network mount). - /// - /// Returns a shared pointer to a data buffer that contains all or - /// part of the contents of a file. The data will be memory mapped - /// if the file is local and will lazily page in data from the file - /// as memory is accessed. If the data is memory mapped, the data - /// that is mapped will start \a offset bytes into the file, and - /// \a length bytes will be mapped. If \a length is - /// greater than the number of bytes available in the file starting - /// at \a offset, the number of bytes will be appropriately - /// truncated. The final number of bytes that get mapped can be - /// verified using the DataBuffer::GetByteSize() function on the return - /// shared data pointer object contents. - /// - /// If the file is on a network mount the data will be read into a - /// heap buffer immediately so that accesses to the data won't later - /// cause a crash if we touch a page that isn't paged in and the - /// network mount has been disconnected or gone away. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// A shared pointer to the memory mapped data. This shared - /// pointer can contain a nullptr DataBuffer pointer, so the contained - /// pointer must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP MemoryMapFileContentsIfLocal(off_t file_offset, - size_t file_size) const; - - //------------------------------------------------------------------ - /// Read part of, or the entire contents of, a file into a heap based data - /// buffer. - /// - /// Returns a shared pointer to a data buffer that contains all or - /// part of the contents of a file. The data copies into a heap based - /// buffer that lives in the DataBuffer shared pointer object returned. - /// The data that is cached will start \a offset bytes into the - /// file, and \a length bytes will be mapped. If \a length is - /// greater than the number of bytes available in the file starting - /// at \a offset, the number of bytes will be appropriately - /// truncated. The final number of bytes that get mapped can be - /// verified using the DataBuffer::GetByteSize() function. - /// - /// @param[in] offset - /// The offset in bytes from the beginning of the file where - /// memory mapping should begin. - /// - /// @param[in] length - /// The size in bytes that should be mapped starting \a offset - /// bytes into the file. If \a length is \c SIZE_MAX, map - /// as many bytes as possible. - /// - /// @return - /// A shared pointer to the memory mapped data. This shared - /// pointer can contain a nullptr DataBuffer pointer, so the contained - /// pointer must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP ReadFileContents(off_t offset = 0, - size_t length = SIZE_MAX, - Error *error_ptr = nullptr) const; - - size_t ReadFileContents(off_t file_offset, void *dst, size_t dst_len, - Error *error_ptr) const; - - //------------------------------------------------------------------ - /// Read the entire contents of a file as data that can be used - /// as a C string. - /// - /// Read the entire contents of a file and ensure that the data - /// is NULL terminated so it can be used as a C string. - /// - /// @return - /// A shared pointer to the data. This shared pointer can - /// contain a nullptr DataBuffer pointer, so the contained pointer - /// must be checked prior to using it. - //------------------------------------------------------------------ - lldb::DataBufferSP ReadFileContentsAsCString(Error *error_ptr = nullptr); - - //------------------------------------------------------------------ /// Normalize a pathname by collapsing redundant separators and /// up-level references. //------------------------------------------------------------------ @@ -639,7 +510,8 @@ public: void SetFile(llvm::StringRef path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative); - void SetFile(llvm::StringRef path, bool resolve_path, ArchSpec arch); + void SetFile(llvm::StringRef path, bool resolve_path, + const llvm::Triple &Triple); bool IsResolved() const { return m_is_resolved; } @@ -659,21 +531,6 @@ public: void SetIsResolved(bool is_resolved) { m_is_resolved = is_resolved; } //------------------------------------------------------------------ - /// Read the file into an array of strings, one per line. - /// - /// Opens and reads the file in this object into an array of strings, - /// one string per line of the file. Returns a boolean indicating - /// success or failure. - /// - /// @param[out] lines - /// The string array into which to read the file. - /// - /// @result - /// Returns the number of lines that were read from the file. - //------------------------------------------------------------------ - size_t ReadFileLines(STLStringArray &lines); - - //------------------------------------------------------------------ /// Resolves user name and links in \a path, and overwrites the input /// argument with the resolved path. /// @@ -696,53 +553,27 @@ public: ConstString GetLastPathComponent() const; - //------------------------------------------------------------------ - /// Resolves the user name at the beginning of \a src_path, and writes the - /// output - /// to \a dst_path. Note, \a src_path can contain other path components after - /// the - /// user name, they will be copied over, and if the path doesn't start with - /// "~" it - /// will also be copied over to \a dst_path. - /// - /// @param[in] src_path - /// Input path to be resolved. - /// - /// @param[in] dst_path - /// Buffer to store the resolved path. - //------------------------------------------------------------------ - static void ResolveUsername(llvm::SmallVectorImpl<char> &path); - - static size_t ResolvePartialUsername(llvm::StringRef partial_name, - StringList &matches); - enum EnumerateDirectoryResult { eEnumerateDirectoryResultNext, // Enumerate next entry in the current // directory eEnumerateDirectoryResultEnter, // Recurse into the current entry if it is a // directory or symlink, or next if not - eEnumerateDirectoryResultExit, // Exit from the current directory at the - // current level. eEnumerateDirectoryResultQuit // Stop directory enumerations at any level }; typedef EnumerateDirectoryResult (*EnumerateDirectoryCallbackType)( - void *baton, FileType file_type, const FileSpec &spec); + void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec); - static EnumerateDirectoryResult - EnumerateDirectory(llvm::StringRef dir_path, bool find_directories, - bool find_files, bool find_other, - EnumerateDirectoryCallbackType callback, - void *callback_baton); + static void EnumerateDirectory(llvm::StringRef dir_path, + bool find_directories, bool find_files, + bool find_other, + EnumerateDirectoryCallbackType callback, + void *callback_baton); - typedef std::function<EnumerateDirectoryResult(FileType file_type, - const FileSpec &spec)> + typedef std::function<EnumerateDirectoryResult( + llvm::sys::fs::file_type file_type, const FileSpec &spec)> DirectoryCallback; - static EnumerateDirectoryResult - ForEachItemInDirectory(llvm::StringRef dir_path, - DirectoryCallback const &callback); - protected: //------------------------------------------------------------------ // Member variables diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Flags.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Flags.h index d1bf685..1b30385 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Flags.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Flags.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Flags_h_ -#define liblldb_Flags_h_ +#ifndef LLDB_UTILITY_FLAGS_H +#define LLDB_UTILITY_FLAGS_H #include <cstddef> #include <cstdint> @@ -16,7 +16,7 @@ namespace lldb_private { //---------------------------------------------------------------------- -/// @class Flags Flags.h "lldb/Core/Flags.h" +/// @class Flags Flags.h "lldb/Utility/Flags.h" /// @brief A class to manage flags. /// /// The Flags class managed flag bits and allows testing and diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/History.h b/contrib/llvm/tools/lldb/include/lldb/Utility/History.h index fcffcdd..c6882b6 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/History.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/History.h @@ -10,17 +10,19 @@ #ifndef lldb_History_h_ #define lldb_History_h_ -// C Includes -#include <stdint.h> +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN // C++ Includes #include <mutex> #include <stack> #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-public.h" +#include <stddef.h> // for size_t +#include <stdint.h> + +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Host/IOObject.h b/contrib/llvm/tools/lldb/include/lldb/Utility/IOObject.h index 90e0bcd..61f2881 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Host/IOObject.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/IOObject.h @@ -32,12 +32,12 @@ public: IOObject(FDType type, bool should_close) : m_fd_type(type), m_should_close_fd(should_close) {} - virtual ~IOObject() {} + virtual ~IOObject(); - virtual Error Read(void *buf, size_t &num_bytes) = 0; - virtual Error Write(const void *buf, size_t &num_bytes) = 0; + virtual Status Read(void *buf, size_t &num_bytes) = 0; + virtual Status Write(const void *buf, size_t &num_bytes) = 0; virtual bool IsValid() const = 0; - virtual Error Close() = 0; + virtual Status Close() = 0; FDType GetFdType() const { return m_fd_type; } @@ -51,6 +51,6 @@ protected: private: DISALLOW_COPY_AND_ASSIGN(IOObject); }; -} +} // namespace lldb_private #endif diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/JSON.h b/contrib/llvm/tools/lldb/include/lldb/Utility/JSON.h index 145ef48..8bf9c4b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/JSON.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/JSON.h @@ -10,19 +10,20 @@ #ifndef utility_JSON_h_ #define utility_JSON_h_ -#include "lldb/Core/Stream.h" #include "lldb/Utility/StringExtractor.h" -#include <inttypes.h> #include <map> #include <memory> -#include <stdint.h> #include <string> +#include <type_traits> #include <vector> -#include "llvm/Support/Casting.h" +#include <stdint.h> namespace lldb_private { +class Stream; +} +namespace lldb_private { class JSONValue { public: @@ -252,7 +253,7 @@ class JSONParser : public StringExtractor { public: enum Token { Invalid, - Error, + Status, ObjectStart, ObjectEnd, ArrayStart, @@ -268,7 +269,7 @@ public: EndOfFile }; - JSONParser(const char *cstr); + JSONParser(llvm::StringRef data); int GetEscapedChar(bool &was_escaped); diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/LLDBAssert.h b/contrib/llvm/tools/lldb/include/lldb/Utility/LLDBAssert.h index 328a4d4..9d9f3ce 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/LLDBAssert.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/LLDBAssert.h @@ -1,5 +1,4 @@ -//===----------------- LLDBAssert.h --------------------------------*- C++ -//-*-===// +//===----------------- LLDBAssert.h ------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,8 +10,6 @@ #ifndef utility_LLDBAssert_h_ #define utility_LLDBAssert_h_ -#include <assert.h> - #ifdef LLDB_CONFIGURATION_DEBUG #define lldbassert(x) assert(x) #else diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/Log.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Log.h new file mode 100644 index 0000000..d856fc8 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Log.h @@ -0,0 +1,216 @@ +//===-- Log.h ---------------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_UTILITY_LOG_H +#define LLDB_UTILITY_LOG_H + +#include "lldb/Utility/Flags.h" +#include "lldb/Utility/Logging.h" +#include "lldb/lldb-defines.h" + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringMap.h" // for StringMap +#include "llvm/ADT/StringRef.h" // for StringRef, StringLiteral +#include "llvm/Support/FormatVariadic.h" +#include "llvm/Support/ManagedStatic.h" +#include "llvm/Support/RWMutex.h" + +#include <atomic> +#include <cstdarg> +#include <cstdint> +#include <memory> // for shared_ptr +#include <string> // for string +#include <type_traits> // for forward + +namespace llvm { +class raw_ostream; +} +//---------------------------------------------------------------------- +// Logging Options +//---------------------------------------------------------------------- +#define LLDB_LOG_OPTION_THREADSAFE (1u << 0) +#define LLDB_LOG_OPTION_VERBOSE (1u << 1) +#define LLDB_LOG_OPTION_PREPEND_SEQUENCE (1u << 3) +#define LLDB_LOG_OPTION_PREPEND_TIMESTAMP (1u << 4) +#define LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD (1u << 5) +#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME (1U << 6) +#define LLDB_LOG_OPTION_BACKTRACE (1U << 7) +#define LLDB_LOG_OPTION_APPEND (1U << 8) +#define LLDB_LOG_OPTION_PREPEND_FILE_FUNCTION (1U << 9) + +//---------------------------------------------------------------------- +// Logging Functions +//---------------------------------------------------------------------- +namespace lldb_private { + +class Log final { +public: + // Description of a log channel category. + struct Category { + llvm::StringLiteral name; + llvm::StringLiteral description; + uint32_t flag; + }; + + // This class describes a log channel. It also encapsulates the behavior + // necessary to enable a log channel in an atomic manner. + class Channel { + std::atomic<Log *> log_ptr; + friend class Log; + + public: + const llvm::ArrayRef<Category> categories; + const uint32_t default_flags; + + constexpr Channel(llvm::ArrayRef<Log::Category> categories, + uint32_t default_flags) + : log_ptr(nullptr), categories(categories), + default_flags(default_flags) {} + + // This function is safe to call at any time + // If the channel is disabled after (or concurrently with) this function + // returning a non-null Log pointer, it is still safe to attempt to write to + // the Log object -- the output will be discarded. + Log *GetLogIfAll(uint32_t mask) { + Log *log = log_ptr.load(std::memory_order_relaxed); + if (log && log->GetMask().AllSet(mask)) + return log; + return nullptr; + } + + // This function is safe to call at any time + // If the channel is disabled after (or concurrently with) this function + // returning a non-null Log pointer, it is still safe to attempt to write to + // the Log object -- the output will be discarded. + Log *GetLogIfAny(uint32_t mask) { + Log *log = log_ptr.load(std::memory_order_relaxed); + if (log && log->GetMask().AnySet(mask)) + return log; + return nullptr; + } + }; + + //------------------------------------------------------------------ + // Static accessors for logging channels + //------------------------------------------------------------------ + static void Register(llvm::StringRef name, Channel &channel); + static void Unregister(llvm::StringRef name); + + static bool + EnableLogChannel(const std::shared_ptr<llvm::raw_ostream> &log_stream_sp, + uint32_t log_options, llvm::StringRef channel, + llvm::ArrayRef<const char *> categories, + llvm::raw_ostream &error_stream); + + static bool DisableLogChannel(llvm::StringRef channel, + llvm::ArrayRef<const char *> categories, + llvm::raw_ostream &error_stream); + + static bool ListChannelCategories(llvm::StringRef channel, llvm::raw_ostream &stream); + + static void DisableAllLogChannels(); + + static void ListAllLogChannels(llvm::raw_ostream &stream); + + //------------------------------------------------------------------ + // Member functions + // + // These functions are safe to call at any time you have a Log* obtained from + // the Channel class. If logging is disabled between you obtaining the Log + // object and writing to it, the output will be silently discarded. + //------------------------------------------------------------------ + Log(Channel &channel) : m_channel(channel) {} + ~Log() = default; + + void PutCString(const char *cstr); + void PutString(llvm::StringRef str); + + template <typename... Args> + void Format(llvm::StringRef file, llvm::StringRef function, + const char *format, Args &&... args) { + Format(file, function, llvm::formatv(format, std::forward<Args>(args)...)); + } + + void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); + + void VAPrintf(const char *format, va_list args); + + void Error(const char *fmt, ...) __attribute__((format(printf, 2, 3))); + + void VAError(const char *format, va_list args); + + void Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3))); + + void Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3))); + + const Flags GetOptions() const; + + const Flags GetMask() const; + + bool GetVerbose() const; + +private: + Channel &m_channel; + + // The mutex makes sure enable/disable operations are thread-safe. The options + // and mask variables are atomic to enable their reading in + // Channel::GetLogIfAny without taking the mutex to speed up the fast path. + // Their modification however, is still protected by this mutex. + llvm::sys::RWMutex m_mutex; + + std::shared_ptr<llvm::raw_ostream> m_stream_sp; + std::atomic<uint32_t> m_options{0}; + std::atomic<uint32_t> m_mask{0}; + + void WriteHeader(llvm::raw_ostream &OS, llvm::StringRef file, + llvm::StringRef function); + void WriteMessage(const std::string &message); + + void Format(llvm::StringRef file, llvm::StringRef function, + const llvm::formatv_object_base &payload); + + std::shared_ptr<llvm::raw_ostream> GetStream() { + llvm::sys::ScopedReader lock(m_mutex); + return m_stream_sp; + } + + void Enable(const std::shared_ptr<llvm::raw_ostream> &stream_sp, + uint32_t options, uint32_t flags); + + void Disable(uint32_t flags); + + typedef llvm::StringMap<Log> ChannelMap; + static llvm::ManagedStatic<ChannelMap> g_channel_map; + + static void ListCategories(llvm::raw_ostream &stream, + const ChannelMap::value_type &entry); + static uint32_t GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry, + llvm::ArrayRef<const char *> categories); + + Log(const Log &) = delete; + void operator=(const Log &) = delete; +}; + +} // namespace lldb_private + +#define LLDB_LOG(log, ...) \ + do { \ + ::lldb_private::Log *log_private = (log); \ + if (log_private) \ + log_private->Format(__FILE__, __FUNCTION__, __VA_ARGS__); \ + } while (0) + +#define LLDB_LOGV(log, ...) \ + do { \ + ::lldb_private::Log *log_private = (log); \ + if (log_private && log_private->GetVerbose()) \ + log_private->Format(__FILE__, __FUNCTION__, __VA_ARGS__); \ + } while (0) + +#endif // LLDB_UTILITY_LOG_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Logging.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Logging.h index d93fa05..865097e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Logging.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Logging.h @@ -7,19 +7,14 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_Core_Logging_h_ -#define liblldb_Core_Logging_h_ +#ifndef LLDB_UTILITY_LOGGING_H +#define LLDB_UTILITY_LOGGING_H -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" +#include <cstdint> //---------------------------------------------------------------------- // Log Bits specific to logging in lldb //---------------------------------------------------------------------- -#define LIBLLDB_LOG_VERBOSE (1u << 0) #define LIBLLDB_LOG_PROCESS (1u << 1) #define LIBLLDB_LOG_THREAD (1u << 2) #define LIBLLDB_LOG_DYNAMIC_LOADER (1u << 3) @@ -59,7 +54,7 @@ namespace lldb_private { -void LogIfAllCategoriesSet(uint32_t mask, const char *format, ...); +class Log; void LogIfAnyCategoriesSet(uint32_t mask, const char *format, ...); @@ -67,17 +62,8 @@ Log *GetLogIfAllCategoriesSet(uint32_t mask); Log *GetLogIfAnyCategoriesSet(uint32_t mask); -uint32_t GetLogMask(); - -bool IsLogVerbose(); - -void DisableLog(const char **categories, Stream *feedback_strm); - -Log *EnableLog(lldb::StreamSP &log_stream_sp, uint32_t log_options, - const char **categories, Stream *feedback_strm); - -void ListLogCategories(Stream *strm); +void InitializeLog(); } // namespace lldb_private -#endif // liblldb_Core_Logging_h_ +#endif // LLDB_UTILITY_LOGGING_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/NameMatches.h b/contrib/llvm/tools/lldb/include/lldb/Utility/NameMatches.h index 50ea7ba..bc9ec70 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/NameMatches.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/NameMatches.h @@ -9,12 +9,20 @@ #ifndef LLDB_UTILITY_NAMEMATCHES_H #define LLDB_UTILITY_NAMEMATCHES_H -#include "lldb/lldb-private-enumerations.h" - #include "llvm/ADT/StringRef.h" namespace lldb_private { -bool NameMatches(llvm::StringRef name, NameMatchType match_type, + +enum class NameMatch { + Ignore, + Equals, + Contains, + StartsWith, + EndsWith, + RegularExpression +}; + +bool NameMatches(llvm::StringRef name, NameMatch match_type, llvm::StringRef match); } diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/PriorityPointerPair.h b/contrib/llvm/tools/lldb/include/lldb/Utility/PriorityPointerPair.h deleted file mode 100644 index 2bd369e..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/PriorityPointerPair.h +++ /dev/null @@ -1,86 +0,0 @@ -//===-- PriorityPointerPair.h ----------------------------------------*- C++ -//-*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_PriorityPointerPair_h_ -#define liblldb_PriorityPointerPair_h_ - -#include "lldb/Utility/SharingPtr.h" -#include "lldb/lldb-public.h" - -namespace lldb_utility { - -//---------------------------------------------------------------------- -// A prioritized pair of SharedPtr<T>. One of the two pointers is high -// priority, the other is low priority. -// The Get() method always returns high, if *high != NULL, -// otherwise, low is returned (even if *low == NULL) -//---------------------------------------------------------------------- - -template <typename T> class PriorityPointerPair { -public: - typedef T &reference_type; - typedef T *pointer_type; - - typedef typename std::shared_ptr<T> T_SP; - - PriorityPointerPair() : m_high(), m_low() {} - - PriorityPointerPair(pointer_type high, pointer_type low) - : m_high(high), m_low(low) {} - - PriorityPointerPair(pointer_type low) : m_high(), m_low(low) {} - - PriorityPointerPair(T_SP &high, T_SP &low) : m_high(high), m_low(low) {} - - PriorityPointerPair(T_SP &low) : m_high(), m_low(low) {} - - void SwapLow(pointer_type l) { m_low.swap(l); } - - void SwapHigh(pointer_type h) { m_high.swap(h); } - - void SwapLow(T_SP l) { m_low.swap(l); } - - void SwapHigh(T_SP h) { m_high.swap(h); } - - T_SP GetLow() { return m_low; } - - T_SP GetHigh() { return m_high; } - - T_SP Get() { - if (m_high.get()) - return m_high; - return m_low; - } - - void ResetHigh() { m_high.reset(); } - - void ResetLow() { m_low.reset(); } - - void Reset() { - ResetLow(); - ResetHigh(); - } - - reference_type operator*() const { return Get().operator*(); } - - pointer_type operator->() const { return Get().operator->(); } - - ~PriorityPointerPair(); - -private: - T_SP m_high; - T_SP m_low; - - DISALLOW_COPY_AND_ASSIGN(PriorityPointerPair); -}; - -} // namespace lldb_utility - -#endif // #ifndef liblldb_PriorityPointerPair_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/Range.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Range.h index c13bc0d..60880db 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/Range.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Range.h @@ -10,7 +10,6 @@ #ifndef utility_Range_h_ #define utility_Range_h_ -#include <algorithm> #include <stdint.h> namespace lldb_utility { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/RegularExpression.h b/contrib/llvm/tools/lldb/include/lldb/Utility/RegularExpression.h index fe34ef5..dba7001 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/RegularExpression.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/RegularExpression.h @@ -36,11 +36,13 @@ inline void regfree(llvm_regex_t *a) { llvm_regfree(a); } #endif #include <regex.h> #endif -#include <stdint.h> #include <string> #include <vector> +#include <stddef.h> // for size_t +#include <stdint.h> + namespace llvm { class StringRef; } // namespace llvm @@ -48,7 +50,8 @@ class StringRef; namespace lldb_private { //---------------------------------------------------------------------- -/// @class RegularExpression RegularExpression.h "lldb/Core/RegularExpression.h" +/// @class RegularExpression RegularExpression.h +/// "lldb/Utility/RegularExpression.h" /// @brief A C++ wrapper class for regex. /// /// This regular expression class wraps the posix regex functions @@ -207,7 +210,7 @@ private: // Member variables //------------------------------------------------------------------ std::string m_re; ///< A copy of the original regular expression text - int m_comp_err; ///< Error code for the regular expression compilation + int m_comp_err; ///< Status code for the regular expression compilation regex_t m_preg; ///< The compiled regular expression }; diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/SafeMachO.h b/contrib/llvm/tools/lldb/include/lldb/Utility/SafeMachO.h index 5da03c1..791410a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/SafeMachO.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/SafeMachO.h @@ -114,6 +114,6 @@ #undef CPU_SUBTYPE_MC980000_ALL #undef CPU_SUBTYPE_MC98601 -#include "llvm/Support/MachO.h" +#include "llvm/BinaryFormat/MachO.h" #endif // liblldb_SafeMachO_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/SelectHelper.h b/contrib/llvm/tools/lldb/include/lldb/Utility/SelectHelper.h index 0251c8e..12950d0 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/SelectHelper.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/SelectHelper.h @@ -10,16 +10,13 @@ #ifndef liblldb_SelectHelper_h_ #define liblldb_SelectHelper_h_ -// C Includes -// C++ Includes -#include <chrono> +#include "lldb/Utility/Status.h" // for Status +#include "lldb/lldb-types.h" // for socket_t -// Other libraries and framework includes #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Optional.h" -// Project includes -#include "lldb/lldb-forward.h" +#include <chrono> class SelectHelper { public: @@ -52,7 +49,7 @@ public: // Call the system's select() to wait for descriptors using // timeout provided in a call the SelectHelper::SetTimeout(), // or infinite wait if no timeout was set. - lldb_private::Error Select(); + lldb_private::Status Select(); protected: struct FDInfo { diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/SharingPtr.h b/contrib/llvm/tools/lldb/include/lldb/Utility/SharingPtr.h index 4e91222..49b0020 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/SharingPtr.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/SharingPtr.h @@ -12,7 +12,6 @@ // C Includes // C++ Includes -#include <algorithm> #include <memory> // Microsoft Visual C++ currently does not enable std::atomic to work @@ -24,6 +23,8 @@ #include <atomic> #endif +#include <stddef.h> + // Other libraries and framework includes // Project includes diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Error.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Status.h index 8131580..d520ebd9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Error.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Status.h @@ -1,4 +1,4 @@ -//===-- Error.h -------------------------------------------------*- C++ -*-===// +//===-- Status.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -7,32 +7,33 @@ // //===----------------------------------------------------------------------===// -#ifndef __DCError_h__ -#define __DCError_h__ -#if defined(__cplusplus) +#ifndef LLDB_UTILITY_STATUS_H +#define LLDB_UTILITY_STATUS_H -#include "llvm/Support/DataTypes.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" // for ErrorType, ErrorType... +#include "llvm/ADT/StringRef.h" // for StringRef +#include "llvm/Support/Error.h" #include "llvm/Support/FormatVariadic.h" - #include <cstdarg> -#include <cstdio> +#include <stdint.h> // for uint32_t #include <string> +#include <system_error> // for error_code +#include <type_traits> // for forward -#include "lldb/lldb-private.h" - -#include "llvm/Support/FormatVariadic.h" +namespace llvm { +class raw_ostream; +} namespace lldb_private { -class Log; - //---------------------------------------------------------------------- -/// @class Error Error.h "lldb/Core/Error.h" +/// @class Status Status.h "lldb/Utility/Status.h" /// @brief An error handling class. /// /// This class is designed to be able to hold any error code that can be /// encountered on a given platform. The errors are stored as a value -/// of type Error::ValueType. This value should be large enough to hold +/// of type Status::ValueType. This value should be large enough to hold /// any and all errors that the class supports. Each error has an /// associated type that is of type lldb::ErrorType. New types /// can be added to support new error types, and architecture specific @@ -46,7 +47,7 @@ class Log; /// be cached until the error is cleared of the value of the error /// changes. //---------------------------------------------------------------------- -class Error { +class Status { public: //------------------------------------------------------------------ /// Every error value that this object can contain needs to be able @@ -65,13 +66,17 @@ public: /// @param[in] type /// The type for \a err. //------------------------------------------------------------------ - Error(); + Status(); - explicit Error(ValueType err, lldb::ErrorType type = lldb::eErrorTypeGeneric); + explicit Status(ValueType err, + lldb::ErrorType type = lldb::eErrorTypeGeneric); - explicit Error(const char *format, ...) __attribute__((format(printf, 2, 3))); + /* implicit */ Status(std::error_code EC); - Error(const Error &rhs); + explicit Status(const char *format, ...) + __attribute__((format(printf, 2, 3))); + + Status(const Status &rhs); //------------------------------------------------------------------ /// Assignment operator. /// @@ -81,7 +86,7 @@ public: /// @return /// A const reference to this object. //------------------------------------------------------------------ - const Error &operator=(const Error &rhs); + const Status &operator=(const Status &rhs); //------------------------------------------------------------------ /// Assignment operator from a kern_return_t. @@ -94,9 +99,14 @@ public: /// @return /// A const reference to this object. //------------------------------------------------------------------ - const Error &operator=(uint32_t err); + const Status &operator=(uint32_t err); + + ~Status(); - ~Error(); + // llvm::Error support + explicit Status(llvm::Error error) { *this = std::move(error); } + const Status &operator=(llvm::Error error); + llvm::Error ToError() const; //------------------------------------------------------------------ /// Get the error string associated with the current error. @@ -148,48 +158,6 @@ public: lldb::ErrorType GetType() const; //------------------------------------------------------------------ - /// Log an error to Log(). - /// - /// Log the error given a formatted string \a format. If the this - /// object contains an error code, update the error string to - /// contain the prefix "error: ", followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. Logging always occurs - /// even when the error code contains a non-error value. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //------------------------------------------------------------------ - void PutToLog(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //------------------------------------------------------------------ - /// Log an error to Log() if the error value is an error. - /// - /// Log the error given a formatted string \a format only if the - /// error value in this object describes an error condition. If the - /// this object contains an error, update the error string to - /// contain the prefix "error: " followed by the formatted string, - /// followed by the error value and any string that describes the - /// error value. This allows more context to be given to an error - /// string that remains cached in this object. - /// - /// @param[in] format - /// A printf style format string. - /// - /// @param[in] ... - /// Variable arguments that are needed for the printf style - /// format string \a format. - //------------------------------------------------------------------ - void LogIfError(Log *log, const char *format, ...) - __attribute__((format(printf, 3, 4))); - - //------------------------------------------------------------------ /// Set accessor from a kern_return_t. /// /// Set accesssor for the error value to \a err and the error type @@ -223,7 +191,7 @@ public: /// Set the current error to errno. /// /// Update the error value to be \c errno and update the type to - /// be \c Error::POSIX. + /// be \c Status::POSIX. //------------------------------------------------------------------ void SetErrorToErrno(); @@ -231,7 +199,7 @@ public: /// Set the current error to a generic error. /// /// Update the error value to be \c LLDB_GENERIC_ERROR and update the - /// type to be \c Error::Generic. + /// type to be \c Status::Generic. //------------------------------------------------------------------ void SetErrorToGenericError(); @@ -294,7 +262,7 @@ protected: //------------------------------------------------------------------ /// Member variables //------------------------------------------------------------------ - ValueType m_code; ///< Error code as an integer value. + ValueType m_code; ///< Status code as an integer value. lldb::ErrorType m_type; ///< The type of the above error code. mutable std::string m_string; ///< A string representation of the error code. }; @@ -302,14 +270,10 @@ protected: } // namespace lldb_private namespace llvm { -template <> struct format_provider<lldb_private::Error> { - static void format(const lldb_private::Error &error, llvm::raw_ostream &OS, - llvm::StringRef Options) { - llvm::format_provider<llvm::StringRef>::format(error.AsCString(), OS, - Options); - } +template <> struct format_provider<lldb_private::Status> { + static void format(const lldb_private::Status &error, llvm::raw_ostream &OS, + llvm::StringRef Options); }; } -#endif // #if defined(__cplusplus) -#endif // #ifndef __DCError_h__ +#endif // #ifndef LLDB_UTILITY_STATUS_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Stream.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Stream.h index 1bea3e1..5a00f0a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Stream.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Stream.h @@ -10,21 +10,21 @@ #ifndef liblldb_Stream_h_ #define liblldb_Stream_h_ -// C Includes -#include <stdarg.h> - -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/Flags.h" -#include "lldb/lldb-private.h" - +#include "lldb/Utility/Flags.h" +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" // for ByteOrder::eByteOrderInvalid +#include "llvm/ADT/StringRef.h" // for StringRef #include "llvm/Support/FormatVariadic.h" +#include <stdarg.h> +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t, uint64_t, uint8_t +#include <type_traits> // for forward + namespace lldb_private { //---------------------------------------------------------------------- -/// @class Stream Stream.h "lldb/Core/Stream.h" +/// @class Stream Stream.h "lldb/Utility/Stream.h" /// @brief A stream class that can stream formatted output to a file. //---------------------------------------------------------------------- class Stream { @@ -33,12 +33,8 @@ public: /// \a m_flags bit values. //------------------------------------------------------------------ enum { - eVerbose = (1 << 0), ///< If set, verbose logging is enabled - eDebug = (1 << 1), ///< If set, debug logging is enabled - eAddPrefix = (1 << 2), ///< Add number prefixes for binary, octal and hex - ///when eBinary is clear - eBinary = (1 << 3) ///< Get and put data as binary instead of as the default - ///string mode. + eBinary = (1 << 0) ///< Get and put data as binary instead of as the default + /// string mode. }; //------------------------------------------------------------------ @@ -385,15 +381,6 @@ public: uint32_t GetAddressByteSize() const; //------------------------------------------------------------------ - /// Test if debug logging is enabled. - /// - /// @return - // \b true if the debug flag bit is set in this stream, \b - // false otherwise. - //------------------------------------------------------------------ - bool GetDebug() const; - - //------------------------------------------------------------------ /// The flags accessor. /// /// @return @@ -426,15 +413,6 @@ public: int GetIndentLevel() const; //------------------------------------------------------------------ - /// Test if verbose logging is enabled. - /// - /// @return - // \b true if the verbose flag bit is set in this stream, \b - // false otherwise. - //------------------------------------------------------------------ - bool GetVerbose() const; - - //------------------------------------------------------------------ /// Indent the current line in the stream. /// /// Indent the current line using the current indentation level and diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StreamCallback.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamCallback.h index 4dc72c8..0aa9d5d 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StreamCallback.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamCallback.h @@ -10,32 +10,25 @@ #ifndef liblldb_StreamCallback_h_ #define liblldb_StreamCallback_h_ -#include <mutex> -#include <string> +#include "lldb/lldb-types.h" +#include "llvm/Support/raw_ostream.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint64_t namespace lldb_private { -class StreamCallback : public Stream { +class StreamCallback : public llvm::raw_ostream { public: StreamCallback(lldb::LogOutputCallback callback, void *baton); - - ~StreamCallback() override; - - void Flush() override; - - size_t Write(const void *src, size_t src_len) override; + ~StreamCallback() override = default; private: - typedef std::map<lldb::tid_t, StreamString> collection; lldb::LogOutputCallback m_callback; void *m_baton; - collection m_accumulated_data; - std::mutex m_collection_mutex; - StreamString &FindStreamForThread(lldb::tid_t cur_tid); + void write_impl(const char *Ptr, size_t Size) override; + uint64_t current_pos() const override; }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StreamGDBRemote.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamGDBRemote.h index 150b301..79234cc 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StreamGDBRemote.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamGDBRemote.h @@ -1,5 +1,4 @@ -//===-- StreamGDBRemote.h ----------------------------------------*- C++ -//-*-===// +//===-- StreamGDBRemote.h ----------------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // @@ -11,13 +10,11 @@ #ifndef liblldb_StreamGDBRemote_h_ #define liblldb_StreamGDBRemote_h_ -// C Includes -// C++ Includes +#include "lldb/Utility/StreamString.h" // for StreamString +#include "lldb/lldb-enumerations.h" // for ByteOrder -// Other libraries and framework includes -// Project includes - -#include "lldb/Core/StreamString.h" +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StreamString.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamString.h index 88501a1..0ae3e82 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StreamString.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamString.h @@ -10,9 +10,14 @@ #ifndef liblldb_StreamString_h_ #define liblldb_StreamString_h_ -#include <string> +#include "lldb/Utility/Stream.h" // for Stream +#include "lldb/lldb-enumerations.h" // for ByteOrder +#include "llvm/ADT/StringRef.h" // for StringRef -#include "lldb/Core/Stream.h" +#include <string> // for string + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StreamTee.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamTee.h index 48f92c8..676178a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StreamTee.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StreamTee.h @@ -14,7 +14,7 @@ #include <mutex> -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/StringExtractor.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StringExtractor.h index 624d1ef..311cec8 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/StringExtractor.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StringExtractor.h @@ -10,16 +10,15 @@ #ifndef utility_StringExtractor_h_ #define utility_StringExtractor_h_ -// C Includes -// C++ Includes -#include <stdint.h> -#include <string> - // Other libraries and framework includes // Project includes #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" +#include <stddef.h> // for size_t +#include <stdint.h> +#include <string> + class StringExtractor { public: enum { BigEndian = 0, LittleEndian = 1 }; @@ -112,6 +111,8 @@ public: size_t GetHexByteStringTerminatedBy(std::string &str, char terminator); + bool ConsumeFront(const llvm::StringRef &str); + const char *Peek() { if (m_index < m_packet.size()) return m_packet.c_str() + m_index; diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/StringLexer.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StringLexer.h index 3a399df..e4fc81a 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/StringLexer.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StringLexer.h @@ -11,9 +11,9 @@ #ifndef utility_StringLexer_h_ #define utility_StringLexer_h_ -#include <initializer_list> -#include <list> -#include <string> +#include <initializer_list> // for initializer_list +#include <string> // for string +#include <utility> // for pair namespace lldb_utility { @@ -41,8 +41,6 @@ public: bool HasAtLeast(Size s); - bool HasAny(Character c); - std::string GetUnlexed(); // This will assert if there are less than s characters preceding the cursor. diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StringList.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StringList.h index 2cd974d..2be9a6b 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StringList.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StringList.h @@ -10,18 +10,18 @@ #ifndef liblldb_StringList_h_ #define liblldb_StringList_h_ -// C Includes -#include <stdint.h> +#include "llvm/ADT/StringRef.h" -// C++ Includes +#include <stddef.h> // for size_t #include <string> +#include <vector> -// Other libraries and framework includes -#include "llvm/ADT/StringRef.h" - -// Project includes -#include "lldb/Core/STLUtils.h" -#include "lldb/lldb-forward.h" +namespace lldb_private { +class Log; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { @@ -49,8 +49,6 @@ public: void AppendList(StringList strings); - bool ReadFileLines(FileSpec &input_file); - size_t GetSize() const; void SetSize(size_t n) { m_strings.resize(n); } @@ -133,7 +131,7 @@ public: } private: - STLStringArray m_strings; + std::vector<std::string> m_strings; }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/StructuredData.h b/contrib/llvm/tools/lldb/include/lldb/Utility/StructuredData.h index efd8100..2ea5fb9 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/StructuredData.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/StructuredData.h @@ -10,27 +10,34 @@ #ifndef liblldb_StructuredData_h_ #define liblldb_StructuredData_h_ -// C Includes -// C++ Includes +#include "llvm/ADT/StringRef.h" + +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/FileSpec.h" // for FileSpec +#include "lldb/lldb-enumerations.h" // for StructuredDataType + +#include <cassert> // for assert +#include <cstddef> // for size_t +#include <cstdint> // for uint64_t #include <functional> #include <map> #include <memory> #include <string> +#include <type_traits> // for move #include <utility> #include <vector> -// Other libraries and framework includes -#include "llvm/ADT/StringRef.h" - -// Project includes -#include "lldb/Core/ConstString.h" -#include "lldb/Core/Stream.h" -#include "lldb/lldb-defines.h" +namespace lldb_private { +class Status; +} +namespace lldb_private { +class Stream; +} namespace lldb_private { //---------------------------------------------------------------------- -/// @class StructuredData StructuredData.h "lldb/Core/StructuredData.h" +/// @class StructuredData StructuredData.h "lldb/Utility/StructuredData.h" /// @brief A class which can hold structured data /// /// The StructuredData class is designed to hold the data from a JSON @@ -64,46 +71,37 @@ public: typedef std::shared_ptr<Dictionary> DictionarySP; typedef std::shared_ptr<Generic> GenericSP; - enum class Type { - eTypeInvalid = -1, - eTypeNull = 0, - eTypeGeneric, - eTypeArray, - eTypeInteger, - eTypeFloat, - eTypeBoolean, - eTypeString, - eTypeDictionary - }; - class Object : public std::enable_shared_from_this<Object> { public: - Object(Type t = Type::eTypeInvalid) : m_type(t) {} + Object(lldb::StructuredDataType t = lldb::eStructuredDataTypeInvalid) + : m_type(t) {} virtual ~Object() = default; virtual bool IsValid() const { return true; } - virtual void Clear() { m_type = Type::eTypeInvalid; } + virtual void Clear() { m_type = lldb::eStructuredDataTypeInvalid; } - Type GetType() const { return m_type; } + lldb::StructuredDataType GetType() const { return m_type; } - void SetType(Type t) { m_type = t; } + void SetType(lldb::StructuredDataType t) { m_type = t; } Array *GetAsArray() { - return ((m_type == Type::eTypeArray) ? static_cast<Array *>(this) - : nullptr); + return ((m_type == lldb::eStructuredDataTypeArray) + ? static_cast<Array *>(this) + : nullptr); } Dictionary *GetAsDictionary() { - return ((m_type == Type::eTypeDictionary) + return ((m_type == lldb::eStructuredDataTypeDictionary) ? static_cast<Dictionary *>(this) : nullptr); } Integer *GetAsInteger() { - return ((m_type == Type::eTypeInteger) ? static_cast<Integer *>(this) - : nullptr); + return ((m_type == lldb::eStructuredDataTypeInteger) + ? static_cast<Integer *>(this) + : nullptr); } uint64_t GetIntegerValue(uint64_t fail_value = 0) { @@ -112,8 +110,9 @@ public: } Float *GetAsFloat() { - return ((m_type == Type::eTypeFloat) ? static_cast<Float *>(this) - : nullptr); + return ((m_type == lldb::eStructuredDataTypeFloat) + ? static_cast<Float *>(this) + : nullptr); } double GetFloatValue(double fail_value = 0.0) { @@ -122,8 +121,9 @@ public: } Boolean *GetAsBoolean() { - return ((m_type == Type::eTypeBoolean) ? static_cast<Boolean *>(this) - : nullptr); + return ((m_type == lldb::eStructuredDataTypeBoolean) + ? static_cast<Boolean *>(this) + : nullptr); } bool GetBooleanValue(bool fail_value = false) { @@ -132,24 +132,23 @@ public: } String *GetAsString() { - return ((m_type == Type::eTypeString) ? static_cast<String *>(this) - : nullptr); + return ((m_type == lldb::eStructuredDataTypeString) + ? static_cast<String *>(this) + : nullptr); } - std::string GetStringValue(const char *fail_value = nullptr) { + llvm::StringRef GetStringValue(const char *fail_value = nullptr) { String *s = GetAsString(); if (s) return s->GetValue(); - if (fail_value && fail_value[0]) - return std::string(fail_value); - - return std::string(); + return fail_value; } Generic *GetAsGeneric() { - return ((m_type == Type::eTypeGeneric) ? static_cast<Generic *>(this) - : nullptr); + return ((m_type == lldb::eStructuredDataTypeGeneric) + ? static_cast<Generic *>(this) + : nullptr); } ObjectSP GetObjectForDotSeparatedPath(llvm::StringRef path); @@ -159,12 +158,12 @@ public: virtual void Dump(Stream &s, bool pretty_print = true) const = 0; private: - Type m_type; + lldb::StructuredDataType m_type; }; class Array : public Object { public: - Array() : Object(Type::eTypeArray) {} + Array() : Object(lldb::eStructuredDataTypeArray) {} ~Array() override = default; @@ -213,7 +212,7 @@ public: return success; } - bool GetItemAtIndexAsString(size_t idx, std::string &result) const { + bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result) const { ObjectSP value_sp = GetItemAtIndex(idx); if (value_sp.get()) { if (auto string_value = value_sp->GetAsString()) { @@ -224,8 +223,8 @@ public: return false; } - bool GetItemAtIndexAsString(size_t idx, std::string &result, - const std::string &default_val) const { + bool GetItemAtIndexAsString(size_t idx, llvm::StringRef &result, + llvm::StringRef default_val) const { bool success = GetItemAtIndexAsString(idx, result); if (!success) result = default_val; @@ -284,7 +283,8 @@ public: class Integer : public Object { public: - Integer(uint64_t i = 0) : Object(Type::eTypeInteger), m_value(i) {} + Integer(uint64_t i = 0) + : Object(lldb::eStructuredDataTypeInteger), m_value(i) {} ~Integer() override = default; @@ -300,7 +300,8 @@ public: class Float : public Object { public: - Float(double d = 0.0) : Object(Type::eTypeFloat), m_value(d) {} + Float(double d = 0.0) + : Object(lldb::eStructuredDataTypeFloat), m_value(d) {} ~Float() override = default; @@ -316,7 +317,8 @@ public: class Boolean : public Object { public: - Boolean(bool b = false) : Object(Type::eTypeBoolean), m_value(b) {} + Boolean(bool b = false) + : Object(lldb::eStructuredDataTypeBoolean), m_value(b) {} ~Boolean() override = default; @@ -332,18 +334,13 @@ public: class String : public Object { public: - String(const char *cstr = nullptr) : Object(Type::eTypeString), m_value() { - if (cstr) - m_value = cstr; - } - - String(const std::string &s) : Object(Type::eTypeString), m_value(s) {} - - String(const std::string &&s) : Object(Type::eTypeString), m_value(s) {} + String() : Object(lldb::eStructuredDataTypeString) {} + explicit String(llvm::StringRef S) + : Object(lldb::eStructuredDataTypeString), m_value(S) {} - void SetValue(const std::string &string) { m_value = string; } + void SetValue(llvm::StringRef S) { m_value = S; } - const std::string &GetValue() { return m_value; } + llvm::StringRef GetValue() { return m_value; } void Dump(Stream &s, bool pretty_print = true) const override; @@ -353,7 +350,7 @@ public: class Dictionary : public Object { public: - Dictionary() : Object(Type::eTypeDictionary), m_dict() {} + Dictionary() : Object(lldb::eStructuredDataTypeDictionary), m_dict() {} ~Dictionary() override = default; @@ -368,13 +365,12 @@ public: } ObjectSP GetKeys() const { - ObjectSP object_sp(new Array()); - Array *array = object_sp->GetAsArray(); + auto object_sp = std::make_shared<Array>(); collection::const_iterator iter; for (iter = m_dict.begin(); iter != m_dict.end(); ++iter) { - ObjectSP key_object_sp(new String()); - key_object_sp->GetAsString()->SetValue(iter->first.AsCString()); - array->Push(key_object_sp); + auto key_object_sp = std::make_shared<String>(); + key_object_sp->SetValue(iter->first.AsCString()); + object_sp->Push(key_object_sp); } return object_sp; } @@ -424,7 +420,7 @@ public: } bool GetValueForKeyAsString(llvm::StringRef key, - std::string &result) const { + llvm::StringRef &result) const { ObjectSP value_sp = GetValueForKey(key); if (value_sp.get()) { if (auto string_value = value_sp->GetAsString()) { @@ -435,14 +431,14 @@ public: return false; } - bool GetValueForKeyAsString(llvm::StringRef key, std::string &result, + bool GetValueForKeyAsString(llvm::StringRef key, llvm::StringRef &result, const char *default_val) const { bool success = GetValueForKeyAsString(key, result); if (!success) { if (default_val) result = default_val; else - result.clear(); + result = llvm::StringRef(); } return success; } @@ -500,19 +496,19 @@ public: } void AddIntegerItem(llvm::StringRef key, uint64_t value) { - AddItem(key, ObjectSP(new Integer(value))); + AddItem(key, std::make_shared<Integer>(value)); } void AddFloatItem(llvm::StringRef key, double value) { - AddItem(key, ObjectSP(new Float(value))); + AddItem(key, std::make_shared<Float>(value)); } - void AddStringItem(llvm::StringRef key, std::string value) { - AddItem(key, ObjectSP(new String(std::move(value)))); + void AddStringItem(llvm::StringRef key, llvm::StringRef value) { + AddItem(key, std::make_shared<String>(std::move(value))); } void AddBooleanItem(llvm::StringRef key, bool value) { - AddItem(key, ObjectSP(new Boolean(value))); + AddItem(key, std::make_shared<Boolean>(value)); } void Dump(Stream &s, bool pretty_print = true) const override; @@ -524,7 +520,7 @@ public: class Null : public Object { public: - Null() : Object(Type::eTypeNull) {} + Null() : Object(lldb::eStructuredDataTypeNull) {} ~Null() override = default; @@ -536,7 +532,7 @@ public: class Generic : public Object { public: explicit Generic(void *object = nullptr) - : Object(Type::eTypeGeneric), m_object(object) {} + : Object(lldb::eStructuredDataTypeGeneric), m_object(object) {} void SetValue(void *value) { m_object = value; } @@ -552,7 +548,7 @@ public: static ObjectSP ParseJSON(std::string json_text); - static ObjectSP ParseJSONFromFile(const FileSpec &file, Error &error); + static ObjectSP ParseJSONFromFile(const FileSpec &file, Status &error); }; } // namespace lldb_private diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/TaskPool.h b/contrib/llvm/tools/lldb/include/lldb/Utility/TaskPool.h index db15b20..f2deaee 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/TaskPool.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/TaskPool.h @@ -10,29 +10,13 @@ #ifndef utility_TaskPool_h_ #define utility_TaskPool_h_ -#if defined(__cplusplus) && defined(_MSC_VER) && (_HAS_EXCEPTIONS == 0) -// Compiling MSVC libraries with _HAS_EXCEPTIONS=0, eliminates most but not all -// calls to __uncaught_exception. Unfortunately, it does seem to eliminate -// the delcaration of __uncaught_excpeiton. Including <eh.h> ensures that it is -// declared. This may not be necessary after MSVC 12. -#include <eh.h> -#endif - -#if defined(_MSC_VER) -// Due to another bug in MSVC 2013, including <future> will generate hundreds of -// warnings in the Concurrency Runtime. This can be removed when we switch to -// MSVC 2015 -#pragma warning(push) -#pragma warning(disable : 4062) -#endif - -#include <cassert> -#include <cstdint> +#include "llvm/ADT/STLExtras.h" +#include <functional> // for bind, function #include <future> #include <list> -#include <queue> -#include <thread> -#include <vector> +#include <memory> // for make_shared +#include <mutex> // for mutex, unique_lock, condition_variable +#include <type_traits> // for forward, result_of, move // Global TaskPool class for running tasks in parallel on a set of worker thread // created the first @@ -70,50 +54,6 @@ private: static void AddTaskImpl(std::function<void()> &&task_fn); }; -// Wrapper class around the global TaskPool implementation to make it possible -// to create a set of -// tasks and then wait for the tasks to be completed by the -// WaitForNextCompletedTask call. This -// class should be used when WaitForNextCompletedTask is needed because this -// class add no other -// extra functionality to the TaskPool class and it have a very minor -// performance overhead. -template <typename T> // The return type of the tasks what will be added to this - // task runner - class TaskRunner { -public: - // Add a task to the task runner what will also add the task to the global - // TaskPool. The - // function doesn't return the std::future for the task because it will be - // supplied by the - // WaitForNextCompletedTask after the task is completed. - template <typename F, typename... Args> void AddTask(F &&f, Args &&... args); - - // Wait for the next task in this task runner to finish and then return the - // std::future what - // belongs to the finished task. If there is no task in this task runner - // (neither pending nor - // comleted) then this function will return an invalid future. Usually this - // function should be - // called in a loop processing the results of the tasks until it returns an - // invalid std::future - // what means that all task in this task runner is completed. - std::future<T> WaitForNextCompletedTask(); - - // Convenience method to wait for all task in this TaskRunner to finish. Do - // NOT use this class - // just because of this method. Use TaskPool instead and wait for each - // std::future returned by - // AddTask in a loop. - void WaitForAllTasks(); - -private: - std::list<std::future<T>> m_ready; - std::list<std::future<T>> m_pending; - std::mutex m_mutex; - std::condition_variable m_cv; -}; - template <typename F, typename... Args> std::future<typename std::result_of<F(Args...)>::type> TaskPool::AddTask(F &&f, Args &&... args) { @@ -143,68 +83,10 @@ template <> struct TaskPool::RunTaskImpl<> { static void Run() {} }; -template <typename T> -template <typename F, typename... Args> -void TaskRunner<T>::AddTask(F &&f, Args &&... args) { - std::unique_lock<std::mutex> lock(m_mutex); - auto it = m_pending.emplace(m_pending.end()); - *it = std::move(TaskPool::AddTask( - [this, it](F f, Args... args) { - T &&r = f(std::forward<Args>(args)...); - - std::unique_lock<std::mutex> lock(this->m_mutex); - this->m_ready.splice(this->m_ready.end(), this->m_pending, it); - lock.unlock(); - - this->m_cv.notify_one(); - return r; - }, - std::forward<F>(f), std::forward<Args>(args)...)); -} - -template <> -template <typename F, typename... Args> -void TaskRunner<void>::AddTask(F &&f, Args &&... args) { - std::unique_lock<std::mutex> lock(m_mutex); - auto it = m_pending.emplace(m_pending.end()); - *it = std::move(TaskPool::AddTask( - [this, it](F f, Args... args) { - f(std::forward<Args>(args)...); - - std::unique_lock<std::mutex> lock(this->m_mutex); - this->m_ready.emplace_back(std::move(*it)); - this->m_pending.erase(it); - lock.unlock(); - - this->m_cv.notify_one(); - }, - std::forward<F>(f), std::forward<Args>(args)...)); -} - -template <typename T> std::future<T> TaskRunner<T>::WaitForNextCompletedTask() { - std::unique_lock<std::mutex> lock(m_mutex); - if (m_ready.empty() && m_pending.empty()) - return std::future<T>(); // No more tasks - - if (m_ready.empty()) - m_cv.wait(lock, [this]() { return !this->m_ready.empty(); }); - - std::future<T> res = std::move(m_ready.front()); - m_ready.pop_front(); - - lock.unlock(); - res.wait(); - - return std::move(res); -} - -template <typename T> void TaskRunner<T>::WaitForAllTasks() { - while (WaitForNextCompletedTask().valid()) - ; -} - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif +// Run 'func' on every value from begin .. end-1. Each worker will grab +// 'batch_size' numbers at a time to work on, so for very fast functions, batch +// should be large enough to avoid too much cache line contention. +void TaskMapOverInt(size_t begin, size_t end, + const llvm::function_ref<void(size_t)> &func); #endif // #ifndef utility_TaskPool_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/TildeExpressionResolver.h b/contrib/llvm/tools/lldb/include/lldb/Utility/TildeExpressionResolver.h new file mode 100644 index 0000000..8462032 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/TildeExpressionResolver.h @@ -0,0 +1,65 @@ +//===--------------------- TildeExpressionResolver.h ------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H +#define LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H + +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/StringSet.h" + +namespace llvm { +template <typename T> class SmallVectorImpl; +} + +namespace lldb_private { +class TildeExpressionResolver { +public: + virtual ~TildeExpressionResolver(); + + /// \brief Resolve a Tilde Expression contained according to bash rules. + /// + /// \param Expr Contains the tilde expression to resolve. A valid tilde + /// expression must begin with a tilde and contain only non + /// separator characters. + /// + /// \param Output Contains the resolved tilde expression, or the original + /// input if the tilde expression could not be resolved. + /// + /// \returns true if \p Expr was successfully resolved, false otherwise. + virtual bool ResolveExact(llvm::StringRef Expr, + llvm::SmallVectorImpl<char> &Output) = 0; + + /// \brief Auto-complete a tilde expression with all matching values. + /// + /// \param Expr Contains the tilde expression prefix to resolve. See + /// ResolveExact() for validity rules. + /// + /// \param Output Contains all matching home directories, each one + /// itself unresolved (i.e. you need to call ResolveExact + /// on each item to turn it into a real path). + /// + /// \returns true if there were any matches, false otherwise. + virtual bool ResolvePartial(llvm::StringRef Expr, + llvm::StringSet<> &Output) = 0; + + /// \brief Resolve an entire path that begins with a tilde expression, + /// replacing the username portion with the matched result. + bool ResolveFullPath(llvm::StringRef Expr, + llvm::SmallVectorImpl<char> &Output); +}; + +class StandardTildeExpressionResolver : public TildeExpressionResolver { +public: + bool ResolveExact(llvm::StringRef Expr, + llvm::SmallVectorImpl<char> &Output) override; + bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override; +}; +} + +#endif // #ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/Timeout.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Timeout.h index 6c6fd00..7b627a4 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/Timeout.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Timeout.h @@ -11,7 +11,8 @@ #define liblldb_Timeout_h_ #include "llvm/ADT/Optional.h" -#include <chrono> +#include "llvm/Support/Chrono.h" +#include "llvm/Support/FormatProviders.h" namespace lldb_private { @@ -52,4 +53,19 @@ public: } // namespace lldb_private +namespace llvm { +template<typename Ratio> +struct format_provider<lldb_private::Timeout<Ratio>, void> { + static void format(const lldb_private::Timeout<Ratio> &timeout, + raw_ostream &OS, StringRef Options) { + typedef typename lldb_private::Timeout<Ratio>::value_type Dur; + + if (!timeout) + OS << "<infinite>"; + else + format_provider<Dur>::format(*timeout, OS, Options); + } +}; +} + #endif // liblldb_Timeout_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/Timer.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Timer.h index 854d3c3..c06ac17 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/Timer.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/Timer.h @@ -10,39 +10,38 @@ #ifndef liblldb_Timer_h_ #define liblldb_Timer_h_ -// C Includes -#include <stdarg.h> -#include <stdio.h> - -// C++ Includes -#include <atomic> -#include <mutex> - -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN #include "llvm/Support/Chrono.h" +#include <atomic> +#include <stdint.h> // for uint32_t namespace lldb_private { +class Stream; //---------------------------------------------------------------------- -/// @class Timer Timer.h "lldb/Core/Timer.h" +/// @class Timer Timer.h "lldb/Utility/Timer.h" /// @brief A timer class that simplifies common timing metrics. -/// -/// A scoped timer class that allows a variety of pthread mutex -/// objects to have a mutex locked when a Timer::Locker -/// object is created, and unlocked when it goes out of scope or -/// when the Timer::Locker::Reset(pthread_mutex_t *) -/// is called. This provides an exception safe way to lock a mutex -/// in a scope. //---------------------------------------------------------------------- class Timer { public: + class Category { + public: + explicit Category(const char *category_name); + + private: + friend class Timer; + const char *m_name; + std::atomic<uint64_t> m_nanos; + std::atomic<Category *> m_next; + + DISALLOW_COPY_AND_ASSIGN(Category); + }; + //-------------------------------------------------------------- /// Default constructor. //-------------------------------------------------------------- - Timer(const char *category, const char *format, ...) + Timer(Category &category, const char *format, ...) __attribute__((format(printf, 3, 4))); //-------------------------------------------------------------- @@ -64,7 +63,7 @@ protected: using TimePoint = std::chrono::steady_clock::time_point; void ChildDuration(TimePoint::duration dur) { m_child_duration += dur; } - const char *m_category; + Category &m_category; TimePoint m_total_start; TimePoint::duration m_child_duration{0}; diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/TraceOptions.h b/contrib/llvm/tools/lldb/include/lldb/Utility/TraceOptions.h new file mode 100644 index 0000000..325ff74 --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/TraceOptions.h @@ -0,0 +1,61 @@ +//===-- TraceOptions.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_TraceOptions_h_ +#define liblldb_TraceOptions_h_ + +#include "lldb/lldb-defines.h" +#include "lldb/lldb-enumerations.h" + +#include "lldb/Utility/StructuredData.h" + +namespace lldb_private { +class TraceOptions { +public: + TraceOptions() : m_trace_params(new StructuredData::Dictionary()) {} + + const StructuredData::DictionarySP &getTraceParams() const { + return m_trace_params; + } + + lldb::TraceType getType() const { return m_type; } + + uint64_t getTraceBufferSize() const { return m_trace_buffer_size; } + + uint64_t getMetaDataBufferSize() const { return m_meta_data_buffer_size; } + + void setTraceParams(const StructuredData::DictionarySP &dict_obj) { + m_trace_params = dict_obj; + } + + void setType(lldb::TraceType type) { m_type = type; } + + void setTraceBufferSize(uint64_t size) { m_trace_buffer_size = size; } + + void setMetaDataBufferSize(uint64_t size) { m_meta_data_buffer_size = size; } + + void setThreadID(lldb::tid_t thread_id) { m_thread_id = thread_id; } + + lldb::tid_t getThreadID() const { return m_thread_id; } + +private: + lldb::TraceType m_type; + uint64_t m_trace_buffer_size; + uint64_t m_meta_data_buffer_size; + lldb::tid_t m_thread_id; + + /// m_trace_params is meant to hold any custom parameters + /// apart from meta buffer size and trace size. + /// The interpretation of such parameters is left to + /// the lldb-server. + StructuredData::DictionarySP m_trace_params; +}; +} + +#endif // liblldb_TraceOptions_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/UUID.h b/contrib/llvm/tools/lldb/include/lldb/Utility/UUID.h index 7cf5cf3..6313025 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/UUID.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/UUID.h @@ -7,19 +7,23 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_UUID_h_ -#define liblldb_UUID_h_ +#ifndef LLDB_UTILITY_UUID_H +#define LLDB_UTILITY_UUID_H // C Includes // C++ Includes +#include <stddef.h> +#include <stdint.h> #include <string> -// Other libraries and framework includes -// Project includes -#include "lldb/lldb-private.h" +namespace llvm { + class StringRef; +} namespace lldb_private { + class Stream; + class UUID { public: // Most UUIDs are 16 bytes, but some Linux build-ids (SHA1) are 20. @@ -50,6 +54,7 @@ public: std::string GetAsString(const char *separator = nullptr) const; + size_t SetFromStringRef(llvm::StringRef str, uint32_t num_uuid_bytes = 16); size_t SetFromCString(const char *c_str, uint32_t num_uuid_bytes = 16); // Decode as many UUID bytes (up to 16) as possible from the C string "cstr" @@ -93,4 +98,4 @@ bool operator>=(const UUID &lhs, const UUID &rhs); } // namespace lldb_private -#endif // liblldb_UUID_h_ +#endif // LLDB_UTILITY_UUID_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/UriParser.h b/contrib/llvm/tools/lldb/include/lldb/Utility/UriParser.h new file mode 100644 index 0000000..db0049d --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/UriParser.h @@ -0,0 +1,32 @@ +//===-- UriParser.h ---------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef utility_UriParser_h_ +#define utility_UriParser_h_ + +#include "llvm/ADT/StringRef.h" + +namespace lldb_private { +class UriParser { +public: + // Parses + // RETURN VALUE + // if url is valid, function returns true and + // scheme/hostname/port/path are set to the parsed values + // port it set to -1 if it is not included in the URL + // + // if the url is invalid, function returns false and + // output parameters remain unchanged + static bool Parse(llvm::StringRef uri, llvm::StringRef &scheme, + llvm::StringRef &hostname, int &port, + llvm::StringRef &path); +}; +} + +#endif // utility_UriParser_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/UserID.h b/contrib/llvm/tools/lldb/include/lldb/Utility/UserID.h index 5964483..b178efd 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/UserID.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/UserID.h @@ -10,7 +10,11 @@ #ifndef liblldb_UserID_h_ #define liblldb_UserID_h_ -#include "lldb/lldb-private.h" +#include "lldb/lldb-defines.h" // for LLDB_INVALID_UID +#include "lldb/lldb-types.h" // for user_id_t +namespace lldb_private { +class Stream; +} namespace lldb_private { diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/Utils.h b/contrib/llvm/tools/lldb/include/lldb/Utility/Utils.h deleted file mode 100644 index 46bc184..0000000 --- a/contrib/llvm/tools/lldb/include/lldb/Utility/Utils.h +++ /dev/null @@ -1,22 +0,0 @@ -//===-- Utils.h -------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef utility_Utils_h_ -#define utility_Utils_h_ - -// These utilities have llvm namespace. -#include "llvm/ADT/STLExtras.h" - -namespace lldb_private { - -// Add lldb utilities here. - -} // namespace lldb_private - -#endif // utility_Utils diff --git a/contrib/llvm/tools/lldb/include/lldb/Utility/VASPrintf.h b/contrib/llvm/tools/lldb/include/lldb/Utility/VASPrintf.h new file mode 100644 index 0000000..6e2404e --- /dev/null +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/VASPrintf.h @@ -0,0 +1,21 @@ +//===-- VASPrintf.h ---------------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_UTILITY_VASPRINTF_H +#define LLDB_UTILITY_VASPRINTF_H + +#include "llvm/ADT/SmallVector.h" + +#include <cstdarg> + +namespace lldb_private { +bool VASprintf(llvm::SmallVectorImpl<char> &buf, const char *fmt, va_list args); +} + +#endif // #ifdef LLDB_UTILITY_VASPRINTF_H diff --git a/contrib/llvm/tools/lldb/include/lldb/Core/VMRange.h b/contrib/llvm/tools/lldb/include/lldb/Utility/VMRange.h index 4ec64c9..f03a1b0 100644 --- a/contrib/llvm/tools/lldb/include/lldb/Core/VMRange.h +++ b/contrib/llvm/tools/lldb/include/lldb/Utility/VMRange.h @@ -10,10 +10,17 @@ #ifndef liblldb_VMRange_h_ #define liblldb_VMRange_h_ -#include "lldb/lldb-private.h" +#include "lldb/lldb-types.h" // for addr_t + +#include <stddef.h> // for size_t +#include <stdint.h> // for uint32_t #include <vector> namespace lldb_private { +class Stream; +} + +namespace lldb_private { //---------------------------------------------------------------------- // A vm address range. These can represent offsets ranges or actual @@ -104,11 +111,6 @@ public: static bool ContainsRange(const VMRange::collection &coll, const VMRange &range); - // Returns a valid index into coll when a match is found, else UINT32_MAX - // is returned - static size_t FindRangeIndexThatContainsValue(const VMRange::collection &coll, - lldb::addr_t value); - protected: lldb::addr_t m_base_addr; lldb::addr_t m_byte_size; diff --git a/contrib/llvm/tools/lldb/include/lldb/lldb-enumerations.h b/contrib/llvm/tools/lldb/include/lldb/lldb-enumerations.h index cf42828..14bae6c 100644 --- a/contrib/llvm/tools/lldb/include/lldb/lldb-enumerations.h +++ b/contrib/llvm/tools/lldb/include/lldb/lldb-enumerations.h @@ -454,6 +454,9 @@ enum LanguageType { enum InstrumentationRuntimeType { eInstrumentationRuntimeTypeAddressSanitizer = 0x0000, eInstrumentationRuntimeTypeThreadSanitizer = 0x0001, + eInstrumentationRuntimeTypeUndefinedBehaviorSanitizer = 0x0002, + eInstrumentationRuntimeTypeMainThreadChecker = 0x0003, + eInstrumentationRuntimeTypeSwiftRuntimeReporting = 0x0004, eNumInstrumentationRuntimeTypes }; @@ -718,6 +721,25 @@ enum BasicType { eBasicTypeOther }; +enum TraceType { + eTraceTypeNone = 0, + + // Hardware Trace generated by the processor. + eTraceTypeProcessorTrace +}; + +enum StructuredDataType { + eStructuredDataTypeInvalid = -1, + eStructuredDataTypeNull = 0, + eStructuredDataTypeGeneric, + eStructuredDataTypeArray, + eStructuredDataTypeInteger, + eStructuredDataTypeFloat, + eStructuredDataTypeBoolean, + eStructuredDataTypeString, + eStructuredDataTypeDictionary +}; + FLAGS_ENUM(TypeClass){ eTypeClassInvalid = (0u), eTypeClassArray = (1u << 0), eTypeClassBlockPointer = (1u << 1), eTypeClassBuiltin = (1u << 2), diff --git a/contrib/llvm/tools/lldb/include/lldb/lldb-forward.h b/contrib/llvm/tools/lldb/include/lldb/lldb-forward.h index 8f70a59..392dc64 100644 --- a/contrib/llvm/tools/lldb/include/lldb/lldb-forward.h +++ b/contrib/llvm/tools/lldb/include/lldb/lldb-forward.h @@ -87,7 +87,7 @@ class DynamicCheckerFunctions; class DynamicLoader; class Editline; class EmulateInstruction; -class Error; +class Status; class EvaluateExpressionOptions; class Event; class EventData; @@ -127,7 +127,6 @@ class MemoryRegionInfo; class LineTable; class Listener; class Log; -class LogChannel; class Mangled; class Materializer; class MemoryHistory; @@ -216,6 +215,7 @@ class StreamFile; class StreamString; class StringList; struct StringSummaryFormat; +class StructuredDataImpl; class StructuredDataPlugin; class SystemRuntime; class TypeSummaryImpl; @@ -255,6 +255,7 @@ class ThreadPlanStepRange; class ThreadPlanStepThrough; class ThreadPlanTracer; class ThreadSpec; +class TraceOptions; class Type; class TypeAndOrName; class TypeCategoryMap; @@ -362,7 +363,6 @@ typedef std::unique_ptr<lldb_private::SystemRuntime> SystemRuntimeUP; typedef std::shared_ptr<lldb_private::LineTable> LineTableSP; typedef std::shared_ptr<lldb_private::Listener> ListenerSP; typedef std::weak_ptr<lldb_private::Listener> ListenerWP; -typedef std::shared_ptr<lldb_private::LogChannel> LogChannelSP; typedef std::shared_ptr<lldb_private::MemoryHistory> MemoryHistorySP; typedef std::shared_ptr<lldb_private::MemoryRegionInfo> MemoryRegionInfoSP; typedef std::unique_ptr<lldb_private::MemoryRegionInfo> MemoryRegionInfoUP; @@ -432,6 +432,7 @@ typedef std::weak_ptr<lldb_private::Stream> StreamWP; typedef std::shared_ptr<lldb_private::StreamFile> StreamFileSP; typedef std::shared_ptr<lldb_private::StringSummaryFormat> StringTypeSummaryImplSP; +typedef std::unique_ptr<lldb_private::StructuredDataImpl> StructuredDataImplUP; typedef std::shared_ptr<lldb_private::StructuredDataPlugin> StructuredDataPluginSP; typedef std::weak_ptr<lldb_private::StructuredDataPlugin> @@ -453,6 +454,7 @@ typedef std::weak_ptr<lldb_private::Thread> ThreadWP; typedef std::shared_ptr<lldb_private::ThreadCollection> ThreadCollectionSP; typedef std::shared_ptr<lldb_private::ThreadPlan> ThreadPlanSP; typedef std::shared_ptr<lldb_private::ThreadPlanTracer> ThreadPlanTracerSP; +typedef std::shared_ptr<lldb_private::TraceOptions> TraceOptionsSP; typedef std::shared_ptr<lldb_private::Type> TypeSP; typedef std::weak_ptr<lldb_private::Type> TypeWP; typedef std::shared_ptr<lldb_private::TypeCategoryImpl> TypeCategoryImplSP; diff --git a/contrib/llvm/tools/lldb/include/lldb/lldb-private-enumerations.h b/contrib/llvm/tools/lldb/include/lldb/lldb-private-enumerations.h index d6e30b3..983ddf3 100644 --- a/contrib/llvm/tools/lldb/include/lldb/lldb-private-enumerations.h +++ b/contrib/llvm/tools/lldb/include/lldb/lldb-private-enumerations.h @@ -10,6 +10,10 @@ #ifndef LLDB_lldb_private_enumerations_h_ #define LLDB_lldb_private_enumerations_h_ +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/FormatProviders.h" +#include "llvm/Support/raw_ostream.h" + namespace lldb_private { //---------------------------------------------------------------------- @@ -112,19 +116,6 @@ typedef enum LazyBool { } LazyBool; //------------------------------------------------------------------ -/// Name matching -//------------------------------------------------------------------ -typedef enum NameMatchType { - eNameMatchIgnore, - eNameMatchEquals, - eNameMatchContains, - eNameMatchStartsWith, - eNameMatchEndsWith, - eNameMatchRegularExpression - -} NameMatchType; - -//------------------------------------------------------------------ /// Instruction types //------------------------------------------------------------------ typedef enum InstructionType { @@ -214,25 +205,13 @@ typedef enum MemoryModuleLoadLevel { enum class LineStatus { Success, // The line that was just edited if good and should be added to the // lines - Error, // There is an error with the current line and it needs to be re-edited - // before it can be accepted - Done // Lines are complete + Status, // There is an error with the current line and it needs to be + // re-edited + // before it can be accepted + Done // Lines are complete }; //---------------------------------------------------------------------- -// Exit Type for inferior processes -//---------------------------------------------------------------------- -typedef enum ExitType { - eExitTypeInvalid, - eExitTypeExit, // The exit status represents the return code from normal - // program exit (i.e. WIFEXITED() was true) - eExitTypeSignal, // The exit status represents the signal number that caused - // the program to exit (i.e. WIFSIGNALED() was true) - eExitTypeStop, // The exit status represents the stop signal that caused the - // program to exit (i.e. WIFSTOPPED() was true) -} ExitType; - -//---------------------------------------------------------------------- // Boolean result of running a Type Validator //---------------------------------------------------------------------- enum class TypeValidatorResult : bool { Success = true, Failure = false }; @@ -257,4 +236,24 @@ enum class CompilerContextKind { } // namespace lldb_private +namespace llvm { +template <> struct format_provider<lldb_private::Vote> { + static void format(const lldb_private::Vote &V, llvm::raw_ostream &Stream, + StringRef Style) { + switch (V) { + case lldb_private::eVoteNo: + Stream << "no"; + return; + case lldb_private::eVoteNoOpinion: + Stream << "no opinion"; + return; + case lldb_private::eVoteYes: + Stream << "yes"; + return; + } + Stream << "invalid"; + } +}; +} + #endif // LLDB_lldb_private_enumerations_h_ diff --git a/contrib/llvm/tools/lldb/include/lldb/lldb-private-forward.h b/contrib/llvm/tools/lldb/include/lldb/lldb-private-forward.h index 69a2311..296facb 100644 --- a/contrib/llvm/tools/lldb/include/lldb/lldb-private-forward.h +++ b/contrib/llvm/tools/lldb/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::NativeProcessProtocol> - NativeProcessProtocolSP; -typedef std::weak_ptr<lldb_private::NativeProcessProtocol> - NativeProcessProtocolWP; typedef std::shared_ptr<lldb_private::NativeRegisterContext> NativeRegisterContextSP; typedef std::shared_ptr<lldb_private::NativeThreadProtocol> diff --git a/contrib/llvm/tools/lldb/include/lldb/lldb-private-interfaces.h b/contrib/llvm/tools/lldb/include/lldb/lldb-private-interfaces.h index c0d5c85..806068e 100644 --- a/contrib/llvm/tools/lldb/include/lldb/lldb-private-interfaces.h +++ b/contrib/llvm/tools/lldb/include/lldb/lldb-private-interfaces.h @@ -16,10 +16,12 @@ #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" +#include "lldb/lldb-private-enumerations.h" + #include <set> namespace lldb_private { -typedef lldb::ABISP (*ABICreateInstance)(const ArchSpec &arch); +typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch); typedef Disassembler *(*DisassemblerCreateInstance)(const ArchSpec &arch, const char *flavor); typedef DynamicLoader *(*DynamicLoaderCreateInstance)(Process *process, @@ -44,8 +46,7 @@ typedef ObjectFile *(*ObjectFileCreateMemoryInstance)( const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset); typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp, - const FileSpec &outfile, Error &error); -typedef LogChannel *(*LogChannelCreateInstance)(); + const FileSpec &outfile, Status &error); typedef EmulateInstruction *(*EmulateInstructionCreateInstance)( const ArchSpec &arch, InstructionType inst_type); typedef OperatingSystem *(*OperatingSystemCreateInstance)(Process *process, @@ -57,8 +58,8 @@ typedef lldb::CommandObjectSP (*LanguageRuntimeGetCommandObject)( CommandInterpreter &interpreter); typedef lldb::StructuredDataPluginSP (*StructuredDataPluginCreateInstance)( Process &process); -typedef Error (*StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, - Target *target); +typedef Status (*StructuredDataFilterLaunchInfo)(ProcessLaunchInfo &launch_info, + Target *target); typedef SystemRuntime *(*SystemRuntimeCreateInstance)(Process *process); typedef lldb::PlatformSP (*PlatformCreateInstance)(bool force, const ArchSpec *arch); @@ -95,7 +96,7 @@ typedef lldb::InstrumentationRuntimeSP (*InstrumentationRuntimeCreateInstance)( const lldb::ProcessSP &process_sp); typedef lldb::TypeSystemSP (*TypeSystemCreateInstance)( lldb::LanguageType language, Module *module, Target *target); -typedef lldb::REPLSP (*REPLCreateInstance)(Error &error, +typedef lldb::REPLSP (*REPLCreateInstance)(Status &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options); diff --git a/contrib/llvm/tools/lldb/include/lldb/lldb-private-types.h b/contrib/llvm/tools/lldb/include/lldb/lldb-private-types.h index 4f192b6..fd21641 100644 --- a/contrib/llvm/tools/lldb/include/lldb/lldb-private-types.h +++ b/contrib/llvm/tools/lldb/include/lldb/lldb-private-types.h @@ -27,7 +27,7 @@ class Platform; class ExecutionContext; typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType)( - const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Error &error); + const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error); //---------------------------------------------------------------------- // Every register is described in detail including its name, alternate diff --git a/contrib/llvm/tools/lldb/include/lldb/lldb-types.h b/contrib/llvm/tools/lldb/include/lldb/lldb-types.h index 07e9f5ac..fc445f5 100644 --- a/contrib/llvm/tools/lldb/include/lldb/lldb-types.h +++ b/contrib/llvm/tools/lldb/include/lldb/lldb-types.h @@ -13,16 +13,10 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-forward.h" -#include <assert.h> -#include <signal.h> #include <stdint.h> //---------------------------------------------------------------------- // All host systems must define: -// lldb::condition_t The native condition type (or a substitute class) -// for conditions on the host system. -// lldb::mutex_t The native mutex type for mutex objects on the host -// system. // lldb::thread_t The native thread type for spawned threads on the // system // lldb::thread_arg_t The type of the one any only thread creation @@ -34,32 +28,22 @@ // #define LLDB_INVALID_PROCESS_ID ... // #define LLDB_INVALID_THREAD_ID ... // #define LLDB_INVALID_HOST_THREAD ... -// #define IS_VALID_LLDB_HOST_THREAD ... //---------------------------------------------------------------------- // TODO: Add a bunch of ifdefs to determine the host system and what // things should be defined. Currently MacOSX is being assumed by default // since that is what lldb was first developed for. -#ifndef _MSC_VER -#include <stdbool.h> -#include <unistd.h> -#endif - #ifdef _WIN32 #include <process.h> namespace lldb { -typedef void *mutex_t; -typedef void *condition_t; typedef void *rwlock_t; typedef void *process_t; // Process type is HANDLE typedef void *thread_t; // Host thread type typedef void *file_t; // Host file type -typedef void *pipe_t; // Host pipe type typedef unsigned int __w64 socket_t; // Host socket type -typedef uint32_t thread_key_t; typedef void *thread_arg_t; // Host thread argument type typedef unsigned thread_result_t; // Host thread result type typedef thread_result_t (*thread_func_t)(void *); // Host thread function type @@ -73,15 +57,11 @@ namespace lldb { //---------------------------------------------------------------------- // MacOSX Types //---------------------------------------------------------------------- -typedef ::pthread_mutex_t mutex_t; -typedef pthread_cond_t condition_t; typedef pthread_rwlock_t rwlock_t; typedef uint64_t process_t; // Process type is just a pid. typedef pthread_t thread_t; // Host thread type typedef int file_t; // Host file type -typedef int pipe_t; // Host pipe type typedef int socket_t; // Host socket type -typedef pthread_key_t thread_key_t; typedef void *thread_arg_t; // Host thread argument type typedef void *thread_result_t; // Host thread result type typedef void *(*thread_func_t)(void *); // Host thread function type @@ -100,10 +80,6 @@ typedef bool (*ExpressionCancelCallback)(ExpressionEvaluationPhase phase, #define LLDB_INVALID_PROCESS ((lldb::process_t)-1) #define LLDB_INVALID_HOST_THREAD ((lldb::thread_t)NULL) -#define IS_VALID_LLDB_HOST_THREAD(t) ((t) != LLDB_INVALID_HOST_THREAD) - -#define LLDB_INVALID_HOST_TIME \ - { 0, 0 } namespace lldb { typedef uint64_t addr_t; |